예제 #1
0
 /// <summary>
 /// Aborts an animation if the reference is valid and it is playing.
 /// </summary>
 /// <param name="animation">The target animation</param>
 public static void SafeAbort(this AbstractAnimation animation)
 {
     if (animation != null && animation.IsPlaying)
     {
         animation.Abort();
     }
 }
예제 #2
0
 /// <summary>
 /// Fast-forwards an animation if the reference is valid and it is running.
 /// </summary>
 /// <param name="animation">The target animation</param>
 public static void SafeFastFowrward(this AbstractAnimation animation)
 {
     if (animation != null && animation.IsPlaying)
     {
         animation.FastForward();
     }
 }
예제 #3
0
 public StateAnimation(string state, AbstractAnimation animation, Func <bool> function = null, int priority = 0)
 {
     this.state     = state;
     this.animation = animation;
     this.priority  = priority;
     this.function  = function;
     played         = false;
 }
예제 #4
0
 public void SetDestroyAnimation(AbstractAnimation destroyAnimation, Direction direction = Direction.CENTER)
 {
     hasDestroyAnimation = true;
     if (GetComponent <AnimationStateMachine>() == null)
     {
         AddComponent(new AnimationStateMachine());
     }
     destroyAnimation.StartedCallback += () => RemoveCollisions();
     destroyAnimation.StoppedCallback += Destroy;
     destroyAnimation.Looping          = false;
     GetComponent <AnimationStateMachine>().RegisterAnimation(DESTROY_AMINATION + direction.ToString(), destroyAnimation, () => false);
 }