예제 #1
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);
        }
예제 #2
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);
        }