Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using com.ootii.Actors.AnimationControllers;
- using UnityEngine;
- namespace HutongGames.PlayMaker.Actions
- {
- [ActionCategory(ActionCategory.ScriptControl)]
- [Tooltip("Allows you to use Ooties motioncontroller")]
- public class MotionAction : FsmStateAction
- {
- private MotionControllerMotion lMotion = null;
- private MotionController mController = null;
- [RequiredField]
- public FsmOwnerDefault gameObject;
- public FsmBool everyFrame;
- public override void Reset()
- {
- Debug.Log("Here");
- mController = null;
- lMotion = null;
- }
- public override void OnEnter()
- {
- Debug.Log("Enter");
- var go = Fsm.GetOwnerDefaultTarget(gameObject);
- mController = go.GetComponent<MotionController>();
- }
- public override void OnUpdate()
- {
- Debug.Log("Update");
- if (everyFrame.Value)
- {
- DoTheMagic();
- }
- }
- //Name your method here
- void DoTheMagic()
- {
- Debug.Log("Magic");
- var go = Fsm.GetOwnerDefaultTarget(gameObject);
- if (go == null)
- {
- return;
- }
- lMotion = mController.GetMotion(100, "Death");
- mController.ActivateMotion(lMotion);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement