// Play the clip from the beginning public void Play(Uni2DAnimationClip a_rAnimationClip) { // Get the clip m_rCurrentClip = a_rAnimationClip; // Reset // Time m_fAnimationTime = 0.0f; m_iCurrentFrameIndex = 0; // Play mode m_eWrapMode = Uni2DAnimationClip.WrapMode.Loop; m_fFrameRate = Uni2DAnimationClip.defaultFrameRate; if (m_rCurrentClip != null) { m_eWrapMode = m_rCurrentClip.wrapMode; m_fFrameRate = m_rCurrentClip.frameRate; } // Play m_bEnabled = true; m_bPaused = false; m_bActived = true; //RaiseAnimationActiveEvent( ); // On New Frame OnNewFrame(); }
// On anim length change private void OnWrapModeChange(Uni2DAnimationClip.WrapMode a_eWrapModePrevious, float a_fFrameShowTimeElapsed) { if (a_eWrapModePrevious == Uni2DAnimationClip.WrapMode.PingPong || m_eWrapMode == Uni2DAnimationClip.WrapMode.PingPong) { if (a_eWrapModePrevious == Uni2DAnimationClip.WrapMode.PingPong) { m_iCurrentFrameIndex = (int)Mathf.PingPong(m_iCurrentFrameIndex, FrameCount - 1); } // Compute the time the image has been show until then m_fAnimationTime = ComputeAnimationTimeFromFrame() + a_fFrameShowTimeElapsed; } }
// Play the clip from the beginning public void Play( Uni2DAnimationClip a_rAnimationClip ) { // Get the clip m_rCurrentClip = a_rAnimationClip; // Reset // Time m_fAnimationTime = 0.0f; m_iCurrentFrameIndex = 0; // Play mode m_eWrapMode = Uni2DAnimationClip.WrapMode.Loop; m_fFrameRate = Uni2DAnimationClip.defaultFrameRate; if(m_rCurrentClip != null) { m_eWrapMode = m_rCurrentClip.wrapMode; m_fFrameRate = m_rCurrentClip.frameRate; } // Play m_bEnabled = true; m_bPaused = false; m_bActived = true; //RaiseAnimationActiveEvent( ); // On New Frame OnNewFrame(); }