/// <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(); } }
/// <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(); } }
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; }
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); }