示例#1
0
        public ISPAnim CrossFadeAuxiliary(SPAnimClip clip, float fadeLength, QueueMode queueMode = QueueMode.PlayNow, PlayMode playMode = PlayMode.StopSameLayer, string auxId = null)
        {
            if (_animation == null)
            {
                throw new AnimationInvalidAccessException();
            }
            if (clip == null)
            {
                throw new System.ArgumentNullException("clip");
            }

            if (clip.Clip is AnimationClip)
            {
                var id   = this.AddAuxiliaryClip(clip.Clip as AnimationClip, auxId);
                var anim = SPAnim.Create(_animation, id);
                anim.Weight       = clip.Weight;
                anim.Speed        = clip.Speed;
                anim.Layer        = clip.Layer;
                anim.WrapMode     = clip.WrapMode;
                anim.BlendMode    = clip.BlendMode;
                anim.TimeSupplier = (clip.TimeSupplier != SPTime.Normal) ? anim.TimeSupplier : null;
                anim.CrossFade(fadeLength, queueMode, playMode);
                return(anim);
            }
            else if (clip.Clip is IScriptableAnimationClip)
            {
                return(this.Play(clip.Clip as IScriptableAnimationClip, playMode));
            }
            else
            {
                return(SPAnim.Null);
            }
        }
示例#2
0
        public string CrossFadeAuxiliaryDirectly(SPAnimClip clip, float fadeLength, PlayMode playMode = PlayMode.StopSameLayer, string auxId = null)
        {
            if (_animation == null)
            {
                throw new AnimationInvalidAccessException();
            }
            if (clip == null)
            {
                throw new System.ArgumentNullException("clip");
            }

            if (clip.Clip is AnimationClip)
            {
                var id   = this.AddAuxiliaryClip(clip.Clip as AnimationClip, auxId);
                var anim = _animation[id];
                anim.weight    = clip.Weight;
                anim.speed     = clip.Speed * this.Speed;
                anim.layer     = clip.Layer;
                anim.wrapMode  = clip.WrapMode;
                anim.blendMode = clip.BlendMode;
                this.CrossFadeInternal(id, fadeLength, playMode, clip.Layer);
                return(id);
            }
            else if (clip.Clip is IScriptableAnimationClip)
            {
                this.Play(clip.Clip as IScriptableAnimationClip, playMode);
            }

            return(null);
        }
示例#3
0
        /// <summary>
        /// Play an AnimationClip on the AnimationController that doesn't already exist on it. If the same clip is called multiple times, it will not be readded.
        /// </summary>
        /// <param name="clip"></param>
        /// <param name="queueMode"></param>
        /// <param name="playMode"></param>
        /// <returns></returns>
        public ISPAnim PlayAuxiliary(SPAnimClip clip, QueueMode queueMode = QueueMode.PlayNow, PlayMode playMode = PlayMode.StopSameLayer)
        {
            if (clip == null)
            {
                throw new System.ArgumentNullException("clip");
            }

            if (clip.Clip is AnimationClip)
            {
                var anim = this.CreateAuxiliarySPAnim_Imp(clip.Clip as AnimationClip);
                anim.Weight       = clip.Weight;
                anim.Speed        = clip.Speed;
                anim.Layer        = clip.Layer;
                anim.WrapMode     = clip.WrapMode;
                anim.BlendMode    = clip.BlendMode;
                anim.TimeSupplier = (clip.TimeSupplier != SPTime.Normal) ? anim.TimeSupplier : null;
                anim.Play(queueMode, playMode);
                return(anim);
            }
            else if (clip.Clip is IScriptableAnimationClip)
            {
                return(this.Play(clip.Clip as IScriptableAnimationClip, playMode));
            }
            else
            {
                return(SPAnim.Null);
            }
        }
示例#4
0
        /// <summary>
        /// Play an AnimationClip on the AnimationController that doesn't already exist on it. If the same clip is called multiple times, it will not be readded.
        /// </summary>
        /// <param name="clip"></param>
        /// <param name="queueMode"></param>
        /// <param name="playMode"></param>
        /// <returns></returns>
        public ISPAnim PlayAuxiliary(SPAnimClip clip, QueueMode queueMode = QueueMode.PlayNow, PlayMode playMode = PlayMode.StopSameLayer, string auxId = null)
        {
            if (_animation == null)
            {
                throw new AnimationInvalidAccessException();
            }
            if (clip == null)
            {
                throw new System.ArgumentNullException("clip");
            }
            if (!_initialized)
            {
                this.Init();
            }

            if (clip.Clip is AnimationClip)
            {
                if (this.ControllerMask != null && !this.ControllerMask.CanPlay(clip))
                {
                    return(null);
                }

                var id   = this.AddAuxiliaryClip(clip.Clip as AnimationClip, auxId);
                var anim = SPAnim.Create(_animation, id);
                anim.Weight       = clip.Weight;
                anim.Speed        = clip.Speed;
                anim.Layer        = clip.Layer;
                anim.WrapMode     = clip.WrapMode;
                anim.BlendMode    = clip.BlendMode;
                anim.TimeSupplier = (clip.TimeSupplier != SPTime.Normal) ? anim.TimeSupplier : null;
                anim.Play(queueMode, playMode);
                return(anim);
            }
            else if (clip.Clip is IScriptableAnimationClip)
            {
                return(this.Play(clip.Clip as IScriptableAnimationClip, playMode));
            }
            else
            {
                return(null);
            }
        }
示例#5
0
        public string PlayAuxiliaryDirectly(SPAnimClip clip, PlayMode playMode = PlayMode.StopSameLayer, string auxId = null)
        {
            if (_animation == null)
            {
                throw new AnimationInvalidAccessException();
            }
            if (clip == null)
            {
                throw new System.ArgumentNullException("clip");
            }
            if (!_initialized)
            {
                this.Init();
            }

            if (clip.Clip is AnimationClip)
            {
                if (this.ControllerMask != null && !this.ControllerMask.CanPlay(clip))
                {
                    return(null);
                }

                var id   = this.AddAuxiliaryClip(clip.Clip as AnimationClip, auxId);
                var anim = _animation[id];
                anim.weight    = clip.Weight;
                anim.speed     = clip.Speed * this.Speed;
                anim.layer     = clip.Layer;
                anim.wrapMode  = clip.WrapMode;
                anim.blendMode = clip.BlendMode;
                this.PlayInternal(anim.name, playMode, clip.Layer);
                return(id);
            }
            else if (clip.Clip is IScriptableAnimationClip)
            {
                this.Play(clip.Clip as IScriptableAnimationClip, playMode);
            }

            return(null);
        }
 public static bool IsValidAndInitialized(SPAnimClip clip)
 {
     return(clip != null && clip.Clip != null && clip.Initialized);
 }
 public static bool IsValid(SPAnimClip clip)
 {
     return(clip != null && clip.Clip != null);
 }