Advertisement
Guest User

Untitled

a guest
Apr 24th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. using com.ootii.Actors.AnimationControllers;
  2. using UnityEngine;
  3.  
  4. namespace HutongGames.PlayMaker.Actions
  5. {
  6.  
  7. [ActionCategory(ActionCategory.ScriptControl)]
  8. [Tooltip("Allows you to use Ooties motioncontroller")]
  9.  
  10. public class MotionAction : FsmStateAction
  11.  
  12. {
  13.  
  14. private MotionControllerMotion lMotion = null;
  15. private MotionController mController = null;
  16.  
  17. [RequiredField]
  18.  
  19. public FsmOwnerDefault gameObject;
  20. public FsmBool everyFrame;
  21.  
  22. public override void Reset()
  23. {
  24. Debug.Log("Here");
  25. mController = null;
  26. lMotion = null;
  27. }
  28.  
  29.  
  30. public override void OnEnter()
  31. {
  32.  
  33. Debug.Log("Enter");
  34. var go = Fsm.GetOwnerDefaultTarget(gameObject);
  35. mController = go.GetComponent<MotionController>();
  36.  
  37. }
  38.  
  39.  
  40.  
  41. public override void OnUpdate()
  42.  
  43. {
  44. Debug.Log("Update");
  45. if (everyFrame.Value)
  46. {
  47. DoTheMagic();
  48. }
  49.  
  50. }
  51.  
  52. //Name your method here
  53. void DoTheMagic()
  54. {
  55. Debug.Log("Magic");
  56.  
  57. var go = Fsm.GetOwnerDefaultTarget(gameObject);
  58.  
  59. if (go == null)
  60. {
  61. return;
  62. }
  63.  
  64. lMotion = mController.GetMotion(100, "Death");
  65. mController.ActivateMotion(lMotion);
  66.  
  67. }
  68.  
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement