public void Init(int num_frames) { m_CurrentTime = 0; m_AniEndTime = num_frames * 1.0f / ANIMATION_FPS; m_NumKeyFrames = num_frames; m_NextKeyFrame = 0; m_PrevKeyFrame = 0; m_Timer.ResetTimer(); }
public void MovementActivated(bool bMoved) { float dt = 0; float acc_speed = 0; MAX_CAM_SPEED = OptionsManager.CameraSpeed; //test comment CAM_ACC = 5.0f * (OptionsManager.CameraSpeed / 10f); CAM_COAST_ACC = 4.0f * (OptionsManager.CameraSpeed / 10f); switch (m_Mode) { case CamMode.Idle: if (bMoved == true) { m_LaunchTimer.ResetTimer(); m_Mode = CamMode.KeyOn; } break; case CamMode.KeyOn: if (bMoved == false) { //m_CurrentSpeed *= -0.2f;//COAST_CAM_INITIAL_SPEED; m_CurrentSpeed *= -0.2f;//OptionsManager.CameraSpeed/20;//COAST_CAM_INITIAL_SPEED; m_CoastTimer.ResetTimer(); m_Mode = CamMode.Coast; } break; case CamMode.Coast: if (bMoved == true) { m_Mode = CamMode.KeyOn; m_CurrentSpeed = 0; } if (m_CurrentSpeed > 0) { m_CurrentSpeed = 0; m_Mode = CamMode.Idle; } break; } //Trace.WriteLine("mode = " + m_Mode.ToString() + "spd = " + m_CurrentSpeed.ToString()); //update camera speed switch (m_Mode) { case CamMode.Idle: break; case CamMode.KeyOn: dt = (float)m_LaunchTimer.GetElapsedTime(); acc_speed = CAM_ACC * dt; if (acc_speed > MAX_CAM_SPEED) { m_CurrentSpeed = MAX_CAM_SPEED; } else { m_CurrentSpeed = acc_speed; } break; case CamMode.Coast: dt = (float)m_CoastTimer.GetElapsedTime(); acc_speed = m_CurrentSpeed + CAM_COAST_ACC * dt; if (m_bRotateMode) { if (acc_speed < 0) { m_Mode = CamMode.Idle; m_CurrentSpeed = 0; } else { m_CurrentSpeed = acc_speed; } } else { if (acc_speed > 0) { m_Mode = CamMode.Idle; m_CurrentSpeed = 0; } else { m_CurrentSpeed = acc_speed; } } break; } }