Beispiel #1
0
        /// <summary>
        /// Wait for the previous animation to finish, then play it smoothly.
        /// (If the previously playing animation is a loop animation, it will not be executed.)
        /// </summary>
        /// <param name="animClipName">Name of the Animation Clip</param>
        /// <param name="fadeTime">Fade Time</param>
        /// <param name="layer">The layer to which the animation is applied. From 0 to 20</param>
        /// <param name="blendMethod">How it is blended with the animation of the lower layers</param>
        /// <param name="isAutoEndIfNotloop">If True, animation that does not play repeatedly is automatically terminated.</param>
        /// <returns>Animation data to be played. If it fails, null is returned.</returns>
        public apAnimPlayData CrossFadeQueued(string animClipName, int layer, apAnimPlayUnit.BLEND_METHOD blendMethod, float fadeTime, bool isAutoEndIfNotloop = false)
        {
            //Debug.LogError("Start CrossFadeQueued [" + animClipName + "]");

            apAnimPlayData playData = GetAnimPlayData_Opt(animClipName);

            if (playData == null)
            {
                Debug.LogError("CrossFade Failed : No AnimClip [" + animClipName + "]");
                return(null);
            }

            if (layer < MIN_LAYER_INDEX || layer > MAX_LAYER_INDEX)
            {
                Debug.LogError("CrossFade Failed : Layer " + layer + " is invalid. Layer must be between " + MIN_LAYER_INDEX + " ~ " + MAX_LAYER_INDEX);
                return(null);
            }

            if (fadeTime < 0.0f)
            {
                fadeTime = 0.0f;
            }

            //Debug.Log("CrossFadeQueued [" + animClipName + "]");

            apAnimPlayQueue playQueue      = _animPlayQueues[layer];
            apAnimPlayUnit  resultPlayUnit = playQueue.PlayQueued(playData, blendMethod, fadeTime, isAutoEndIfNotloop);

            if (resultPlayUnit == null)
            {
                return(null);
            }

            //float delayTime = resultPlayUnit.DelayToPlayTime;
            //float delayTime = Mathf.Clamp01(resultPlayUnit.RemainPlayTime - fadeTime);

            //if (playOption == PLAY_OPTION.StopAllLayers)
            //{
            //	//다른 레이어를 모두 정지시킨다. - 단, 딜레이를 준다.
            //	for (int i = 0; i < _animPlayQueues.Count; i++)
            //	{
            //		if (i == layer)
            //		{ continue; }
            //		_animPlayQueues[i].StopAll(delayTime);
            //	}
            //}

            RefreshPlayOrders();

            return(playData);
        }
        /// <summary>
        /// Wait for the previous animation to finish, then play it.
        /// (If the previously playing animation is a loop animation, it will not be executed.)
        /// </summary>
        /// <param name="animClipName">Name of the Animation Clip</param>
        /// <param name="layer">The layer to which the animation is applied. From 0 to 20</param>
        /// <param name="blendMethod">How it is blended with the animation of the lower layers</param>
        /// <param name="isAutoEndIfNotloop">If True, animation that does not play repeatedly is automatically terminated.</param>
        /// <returns>Animation data to be played. If it fails, null is returned.</returns>
        public apAnimPlayData PlayQueued(apAnimPlayData playData, int layer, apAnimPlayUnit.BLEND_METHOD blendMethod, bool isAutoEndIfNotloop = false)
        {
            if (playData == null)
            {
                Debug.LogError("PlayQueued Failed : Unknown AnimPlayData");
                return(null);
            }

            if (layer < MIN_LAYER_INDEX || layer > MAX_LAYER_INDEX)
            {
                Debug.LogError("PlayQueued Failed : Layer " + layer + " is invalid. Layer must be between " + MIN_LAYER_INDEX + " ~ " + MAX_LAYER_INDEX);
                return(null);
            }

            apAnimPlayQueue playQueue      = _animPlayQueues[layer];
            apAnimPlayUnit  resultPlayUnit = playQueue.PlayQueued(playData, blendMethod, 0.0f, isAutoEndIfNotloop);

            if (resultPlayUnit == null)
            {
                return(null);
            }



            //if (playOption == PLAY_OPTION.StopAllLayers)
            //{
            //	//다른 레이어를 모두 정지시킨다. - 단, 딜레이를 준다.
            //	for (int i = 0; i < _animPlayQueues.Count; i++)
            //	{
            //		if (i == layer)
            //		{ continue; }
            //		_animPlayQueues[i].StopAll(delayTime);
            //	}
            //}

            RefreshPlayOrders();

            return(playData);
        }