Exemple #1
0
        /// @param animator
        ///     The animator to use
        /// @param animationName
        ///     The name of the animation
        /// @param callback
        ///     The function to call once the animation has played once
        ///
        /// @return The created coroutine
        ///
        public static Coroutine PlayAnimation(this Animator animator, string animationName, Action callback = null)
        {
            var time = animator.GetAnimationLength(animationName);

            if (animator.gameObject.activeInHierarchy)
            {
                animator.Play(animationName);
            }
            return(GlobalDirector.WaitFor(time, callback));
        }