private object PlayClip(SPLegacyAnimController controller, UnityEngine.Object clip)
        {
            if (clip is AnimationClip)
            {
                var anim = controller.CreateAuxiliarySPAnim(clip as AnimationClip);
                if (_applyCustomSettings)
                {
                    _settings.Apply(anim);
                }
                if (_crossFadeDur > 0f)
                {
                    anim.CrossFade(_crossFadeDur, _queueMode, _playMode);
                }
                else
                {
                    anim.Play(_queueMode, _playMode);
                }
                return(anim);
            }
            else if (clip is IScriptableAnimationClip)
            {
                return(controller.Play(clip as IScriptableAnimationClip));
            }

            return(null);
        }
        private object PlayClip(Animation controller, AnimationClip clip)
        {
            if (controller == null || !controller.isActiveAndEnabled || clip == null)
            {
                return(null);
            }

            var animController = controller as Animation;
            var id             = "aux*" + clip.GetInstanceID();
            var a = animController[id];

            if (a == null || a.clip != clip)
            {
                animController.AddClip(clip, id);
            }

            AnimationState anim;

            if (_crossFadeDur > 0f)
            {
                anim = animController.CrossFadeQueued(id, _crossFadeDur, _queueMode, _playMode);
            }
            else
            {
                anim = animController.PlayQueued(id, _queueMode, _playMode);
            }
            if (_settingsMask != 0)
            {
                _settings.Apply(anim, _settingsMask);
            }
            return(anim);
        }
        private object PlayClip(object controller, UnityEngine.Object clip)
        {
            if (clip is AnimationClip)
            {
                if (controller is SPLegacyAnimController)
                {
                    var anim = (controller as SPLegacyAnimController).CreateAuxiliarySPAnim(clip as AnimationClip);
                    _settings.Apply(anim);
                    if (_crossFadeDur > 0f)
                    {
                        anim.CrossFade(_crossFadeDur, _queueMode, _playMode);
                    }
                    else
                    {
                        anim.Play(_queueMode, _playMode);
                    }
                    return(anim);
                }
                else if (controller is Animation)
                {
                    var animController = controller as Animation;
                    var id             = "aux*" + clip.GetInstanceID();
                    var a = animController[id];
                    if (a == null || a.clip != clip)
                    {
                        animController.AddClip(clip as AnimationClip, id);
                    }

                    AnimationState anim;
                    if (_crossFadeDur > 0f)
                    {
                        anim = animController.CrossFadeQueued(id, _crossFadeDur, _queueMode, _playMode);
                    }
                    else
                    {
                        anim = animController.PlayQueued(id, _queueMode, _playMode);
                    }
                    _settings.Apply(anim);
                    return(anim);
                }
            }
            else if (clip is IScriptableAnimationClip)
            {
                if (controller is SPLegacyAnimController)
                {
                    return((controller as SPLegacyAnimController).Play(clip as IScriptableAnimationClip));
                }
            }

            return(null);
        }