void _PlayAnim(Anim anim)
    {
        _StopAnim();         // _playingAnim = null;

        _animTime     = 0.0f;
        this.animName = "";
        if (anim != null)
        {
            this.playingAnimName = anim.animName;
        }

        MMD4MecanimAnim.UpdateAnimModel(this, anim, _animTime);           // _playingAnim = anim;

        if (_playingAnim != null && _inactiveModelMorphSet != null)
        {
            if (_playingAnim.morphMotionList != null)
            {
                for (int i = 0; i != _playingAnim.morphMotionList.Length; ++i)
                {
                    _playingAnim.morphMotionList[i].lastKeyFrameIndex = 0;
                    Morph morph = (Morph)(_playingAnim.morphMotionList[i].morph);
                    if (morph != null)
                    {
                        _inactiveModelMorphSet.Remove(morph);
                    }
                }
            }
        }
    }
    void _UpdateAnim()
    {
        if (!this.animEnabled)
        {
            _StopAnim();
            return;
        }

        if (_playingAnim != null)
        {
            if (string.IsNullOrEmpty(this.playingAnimName) ||
                _playingAnim.animName == null || this.playingAnimName != _playingAnim.animName)
            {
                _StopAnim();
            }
        }

        bool updatedAnimModel = false;

        if (_playingAnim == null && !string.IsNullOrEmpty(this.animName))
        {
            if (this.animList != null)
            {
                for (int i = 0; i != this.animList.Length; ++i)
                {
                    if (this.animList[i].animName != null && this.animList[i].animName == this.animName)
                    {
                        _PlayAnim(this.animList[i]);
                        updatedAnimModel = true;
                        break;
                    }
                }
            }
        }

        if (_playingAnim != null)
        {
            if (_playingAnim.animData != null)
            {
                if (!this.animPauseOnEnd)
                {
                    if (_animTime >= (float)(_playingAnim.animData.maxFrame - 1) / 30.0f)                        // Bugfix
                    {
                        _StopAnim();
                    }
                }
            }
            else                 // Failsafe.
            {
                _StopAnim();
            }
        }

        if (_playingAnim == null)
        {
            return;
        }

        if (!updatedAnimModel)
        {
            MMD4MecanimAnim.UpdateAnimModel(this, _playingAnim, _animTime);
        }

        if (_playingAnim != null)
        {
            // Postfix for animWeight2
            if (_playingAnim.morphMotionList != null)
            {
                for (int i = 0; i != _playingAnim.morphMotionList.Length; ++i)
                {
                    if (_playingAnim.morphMotionList[i].morph != null)
                    {
                        ((Morph)_playingAnim.morphMotionList[i].morph).weight2 = _weight2;
                    }
                }
            }

            if (_playingAnim.audioClip != null && _audioSource != null && _audioSource.isPlaying && this.animSyncToAudio)
            {
                _animTime = _audioSource.time;
            }
            else
            {
                _animTime += Time.deltaTime;
            }

            if (_playingAnim.animData != null)
            {
                _animTime = Mathf.Min(_animTime, (float)_playingAnim.animData.maxFrame / 30.0f);
            }
            else
            {
                _animTime = 0.0f;
            }
        }
    }