Ejemplo n.º 1
0
        /// <summary>
        /// Waits until current animation completes.
        /// </summary>
        /// <param name="anim">Target animator instance.</param>
        /// <returns>An asynchronous operation that can be used to track the animation progress.</returns>
        public static IAsyncOperation WaitAsync(this Animator anim)
        {
            var result = new Helpers.WaitAnimatorResult(anim, 0, AsyncUtility.GetUpdateSource());

            result.Start();
            return(result);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Plays an animation without any blending.
        /// </summary>
        /// <param name="anim">Target animation instance.</param>
        /// <param name="animation">Name of the animation to play.</param>
        /// <param name="mode">The mode which lets you choose how this animation will affect others already playing.</param>
        /// <returns>An asynchronous operation that can be used to track the animation progress.</returns>
        public static IAsyncOperation PlayAsync(this Animation anim, string animation, PlayMode mode)
        {
            var result = new Helpers.PlayAnimationResult(anim, animation, mode, AsyncUtility.GetUpdateSource());

            result.Start();
            return(result);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Plays an animator state.
        /// </summary>
        /// <param name="anim">Target animator instance.</param>
        /// <param name="stateName">The state name.</param>
        /// <returns>An asynchronous operation that can be used to track the animation progress.</returns>
        public static IAsyncOperation PlayAsync(this Animator anim, string stateName)
        {
            var result = new Helpers.PlayAnimatorResult(anim, stateName, -1, AsyncUtility.GetUpdateSource());

            result.Start();
            return(result);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Plays an animation without any blending.
        /// </summary>
        /// <param name="anim">Target animation instance.</param>
        /// <param name="mode">The mode which lets you choose how this animation will affect others already playing.</param>
        /// <returns>An asynchronous operation that can be used to track the animation progress.</returns>
        public static IAsyncOperation PlayAsync(this Animation anim, PlayMode mode)
        {
            if (anim.clip)
            {
                var result = new Helpers.PlayAnimationResult(anim, anim.clip.name, mode, AsyncUtility.GetUpdateSource());
                result.Start();
                return(result);
            }

            return(AsyncResult.CanceledOperation);
        }