1234567891011121314151617181920212223242526272829303132333435363738394041 |
- #if CHRONOS_PLAYMAKER
- using HutongGames.PlayMaker;
- namespace Chronos.PlayMaker
- {
- [ActionCategory("Physics 2d (Chronos)")]
- [Tooltip("Gets the Mass of a Game Object's Rigid Body 2D.")]
- public class GetMass2d : ChronosComponentAction<Timeline>
- {
- [RequiredField]
- [CheckForComponent(typeof(Timeline))]
- public FsmOwnerDefault gameObject;
- [RequiredField]
- [UIHint(UIHint.Variable)]
- public FsmFloat storeResult;
- public override void Reset()
- {
- gameObject = null;
- storeResult = null;
- }
- public override void OnEnter()
- {
- DoGetMass();
- Finish();
- }
- private void DoGetMass()
- {
- if (!UpdateCache(Fsm.GetOwnerDefaultTarget(gameObject))) return;
- storeResult.Value = timeline.rigidbody2D.mass;
- }
- }
- }
- #endif
|