// Update is called once per frame void Update() { if (m_cameraMode != null) { m_cameraMode.Update(); } }
// Update is called once per frame public override void Update() { if (mCamMode != null) { mCamMode.Update(); } }
/// <summary> /// Updates the Camera and CameraMode /// </summary> /// <param name="gt"></param> public void Update(GameTime gt) { // Make mode isn't null if (CameraMode != null) { // Center the Camera if (CenterOnObject) { // If your camera is breaking this is likely why, if your game is in fullscreen. // If you find this, please alert me. Target -= new Vector2(_scene.GameWindow.ClientBounds.Width / 2, _scene.GameWindow.ClientBounds.Height / 2); } // Update the Camera Mode CameraMode.Update(Target, gt); } // Is clamping enabled? if (ClampingEnabled) { // Create 2 float variables, x and y float x = Position.X, y = Position.Y; // let the clamping magic begin! x = MathHelper.Clamp(x, MinClampX, MaxClampX); y = MathHelper.Clamp(y, MinClampY, MaxClampY); // and set the position... Position = new Vector2(x, y); } // Lets just make sure to make sure our position is a type of Int so no weird drawing happens! Position = new Vector2((int)Position.X, (int)Position.Y); }