1234567891011121314151617181920212223242526272829303132333435363738394041 |
- #if CHRONOS_PLAYMAKER
- using HutongGames.PlayMaker;
- namespace Chronos.PlayMaker
- {
- [ActionCategory("Physics (Chronos)")]
- [Tooltip("Sets whether a Game Object's Rigidy Body is affected by Gravity.")]
- public class UseGravity : ChronosComponentAction<Timeline>
- {
- [RequiredField]
- [CheckForComponent(typeof(Timeline))]
- public FsmOwnerDefault gameObject;
- [RequiredField]
- public FsmBool useGravity;
- public override void Reset()
- {
- gameObject = null;
- useGravity = true;
- }
- public override void OnEnter()
- {
- DoUseGravity();
- Finish();
- }
- private void DoUseGravity()
- {
- var go = Fsm.GetOwnerDefaultTarget(gameObject);
- if (UpdateCache(go))
- {
- timeline.rigidbody.useGravity = useGravity.Value;
- }
- }
- }
- }
- #endif
|