public void Update()
        {
            if (this.GetSize() > 1)
            {
                if (_isReadyForNextFrame())
                {
                    m_LastAnimTime = GlobalClock.GetTimeInMilliseconds();

                    m_CurrentFrame += 1;

                    if (m_CurrentFrame >= this.GetSize()) //myCurrentFrame < 0
                    {
                        if (this.animData.Repeat)
                        {
                            m_CurrentFrame = 0;
                            return;
                        }
                        m_CurrentFrame = this.GetSize() - 1;
                        Active         = false;
                    }
                }
            }
            else
            {
                m_CurrentFrame = 0;
            }
        }
 public void init()
 {
     m_FlipHorizontally = false;
     m_FlipVertically   = false;
     m_CurrentFrame     = 0;
     Active             = true;
     m_CurrentAnimTime  = GlobalClock.GetTimeInMilliseconds();
     m_FrameTime        = Constants.ANIM_FRAME_TIME;
     m_LastAnimTime     = m_CurrentAnimTime;
 }
        public bool isReady()
        {
            currentTime = GlobalClock.GetTimeInMilliseconds();

            if ((currentTime - lastTime) >= periodTime * 1000.0)
            {
                lastTime = currentTime;
                return(true);
            }

            return(false);
        }
 public void resetByPeriodTime(float period_time_in_seconds)
 {
     this.periodTime = period_time_in_seconds;
     this.freq       = (periodTime > 0.0) ? (1.0 / periodTime) : 0.0;
     lastTime        = GlobalClock.GetTimeInMilliseconds();
 }
 public void resetByFrequency(double frequency)
 {
     this.freq       = frequency;
     this.periodTime = (frequency > 0.0) ? (1.0 / frequency) : 0.0;
     lastTime        = GlobalClock.GetTimeInMilliseconds();
 }
 private bool _isReadyForNextFrame()
 {
     m_CurrentAnimTime = GlobalClock.GetTimeInMilliseconds();
     return(m_CurrentAnimTime - m_LastAnimTime >= m_FrameTime);
 }