// ========================== [ Division ] ========================== //

    public void DoPlaySpriteAnimation(string strSpriteName, float fAnimationDuratinSec, bool bIsLoop, System.Action OnFinishAnimation, System.Action OnAnimationEvent = null)
    {
        if (strSpriteName.Equals(_strCurrentAnimationName))
        {
            return;
        }

        if (g_mapSpriteAnimation.ContainsKey(strSpriteName))
        {
            _strCurrentAnimationName          = strSpriteName;
            _OnFinishAnimation                = OnFinishAnimation;
            _pSpriteAnimation.loop            = bIsLoop;
            _pSpriteAnimation.framesPerSecond = (int)(g_mapSpriteAnimation[strSpriteName].Length / fAnimationDuratinSec);
            _pSpriteAnimation.frames          = g_mapSpriteAnimation[strSpriteName];
            _pSpriteAnimation.frameIndex      = 0;

            if (OnAnimationEvent != null && g_mapSpriteAnimation_EventIndex.ContainsKey(strSpriteName))
            {
                _pSpriteAnimation.Play(g_mapSpriteAnimation_EventIndex[strSpriteName], OnAnimationEvent);
            }
            else
            {
                _pSpriteAnimation.Play();
            }
        }
        else
        {
            Debug.LogWarning("애니메이션이 목록에 없다.." + strSpriteName);
        }
    }
Exemple #2
0
    private IEnumerator CoPlay2DSpriteAnimation()
    {
#if NGUI
        if (_p2DSpriteAnimation.frames.Length == 0)
        {
            Debug.LogWarning("Effect Sprite Frame Length가 0입니다");
            ProcOnFinishEffect();
            yield break;
        }

        if (_p2DSpriteAnimation.loop)
        {
            _p2DSpriteAnimation.Play();
        }
        else
        {
            _p2DSpriteAnimation.Play(ProcOnFinishEffect);
        }
#endif
        yield return(null);
    }