コード例 #1
0
    public void CancelAnimation()
    {
        //  Let last animation clip play to its end, and
        //  cancel rest of scheduled animation.
        if (animationClips.Count > 0)
        {
            //  Reschedule clip to be on its last lap.
            AnimationClip currentClip = animationClips[0];
            currentClip.nTimes = 1;

            while (animationClips.Count > 1)
            {
                //  Stop scheduled audio clips.
                AnimationClip scheduledClip = animationClips[1];
                scheduledClip.ClearAudioEvents();

                animationClips.RemoveAt(1);
            }
        }
    }