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 (!_initialized)
            {
                this.Init();
            }

            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);
        }
Example #2
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 (!_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.CrossFade(fadeLength, queueMode, playMode);
                return(anim);
            }
            else if (clip.Clip is IScriptableAnimationClip)
            {
                return(this.Play(clip.Clip as IScriptableAnimationClip, playMode));
            }
            else
            {
                return(SPAnim.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);
 }