PlayMaker Updates & Downloads > Share New Actions

Spine Actions

<< < (2/2)

pixelpaste:
Whoo thanks a lot for this!

artixpro:
using UnityEngine;


namespace HutongGames.PlayMaker.Actions
{

   [ActionCategory("Artix")]
   [Tooltip("Artix Production")]
   public class SendEventEndAnimation : FsmStateAction
   {

      [RequiredField]
      [CheckForComponent(typeof(UnityEngine.Animator))]
      [Tooltip("The GameObject to be observed.")]
      public FsmOwnerDefault gameObject;

      [RequiredField]
      [Tooltip("Send this event when animation finished.")]
      public FsmEvent sendEvent;

      [RequiredField]
      [Tooltip("The name of the animation to be observed.")]
      public FsmString animationName;

      private Animator animator;

      public override void Reset() {
         gameObject = null;
         sendEvent = null;
         animationName = null;
      }

      // Code that runs on entering the state.
      public override void OnEnter() {
         var go = Fsm.GetOwnerDefaultTarget(gameObject);
         animator = go.GetComponent<Animator>();
      }

      // Code that runs every frame.
      public override void OnUpdate() {
         var a = animator.GetCurrentAnimatorStateInfo(0);
         if (a.IsName(animationName.Value) && a.normalizedTime >= 0.98f) {
            Fsm.Event(sendEvent);
         }
      }
   }
}

rondmc:
Gonna follow for this, thanks! I just got Spine and PlayMaker functionality is always welcomed.

Navigation

[0] Message Index

[*] Previous page

Go to full version