void Update() { if (m_PlayMode == PLAYMODE.SELECT) { return; } if (m_Renderer == null || m_nTilingX * m_nTilingY == 0) { return; } if (m_fDelayTime != 0) { if (GetEngineTime() < m_fStartTime + m_fDelayTime) { return; } m_fDelayTime = 0; InitAnimationTimer(); m_Renderer.enabled = true; } if (m_PlayMode != PLAYMODE.RANDOM) { int nSeqIndex = (int)(m_Timer.GetTime() * m_fFps); if (nSeqIndex == 0) { if (m_NcSpriteFactoryCom != null) { m_NcSpriteFactoryCom.OnAnimationStartFrame(this); } // if (m_funcStartSprite != "") // gameObject.SendMessage(m_funcStartSprite, this, SendMessageOptions.DontRequireReceiver); } if (m_NcSpriteFactoryCom != null && m_nFrameCount <= 0) { m_NcSpriteFactoryCom.OnAnimationLastFrame(this, 0); } else { if ((m_PlayMode == PLAYMODE.PINGPONG ? m_nFrameCount * 2 - 1 : m_nFrameCount) <= nSeqIndex) // first loop { if (m_bLoop == false) { if (m_NcSpriteFactoryCom != null) { if (m_NcSpriteFactoryCom.OnAnimationLastFrame(this, 1)) { return; } } UpdateEndAnimation(); return; } else { if (m_PlayMode == PLAYMODE.PINGPONG) { if (m_NcSpriteFactoryCom != null && nSeqIndex % (m_nFrameCount * 2 - 2) == 1) { if (m_NcSpriteFactoryCom.OnAnimationLastFrame(this, nSeqIndex / (m_nFrameCount * 2 - 1))) { return; } } } else { if (m_NcSpriteFactoryCom != null && nSeqIndex % m_nFrameCount == 0) { if (m_NcSpriteFactoryCom.OnAnimationLastFrame(this, nSeqIndex / m_nFrameCount)) { return; } } } } } SetIndex(nSeqIndex); } } }