public void SetFollowShip(Ship ship) { _followShipController.Target = ship; State = CameraControlState.FollowShip; }
public void SetFree() { State = CameraControlState.Free; }
public void SetFollowToPosition(Vector2 targetPos) { _followToPositionController.TargetPos = targetPos; State = CameraControlState.FollowToPosition; }
public void Update(KeyboardState ks) { switch (State) { case CameraControlState.Position: if (ks.IsKeyDown(Keys.H)) { _camera.Position += _panIncrementX; } if (ks.IsKeyDown(Keys.L)) { _camera.Position -= _panIncrementX; } if (ks.IsKeyDown(Keys.J)) { _camera.Position -= _panIncrementY; } if (ks.IsKeyDown(Keys.K)) { _camera.Position += _panIncrementY; } break; case CameraControlState.Rotation: if (ks.IsKeyDown(Keys.H)) { _camera.Rotation -= _rotationIncrement; } if (ks.IsKeyDown(Keys.L)) { _camera.Rotation += _rotationIncrement; } break; case CameraControlState.Zoom: if (ks.IsKeyDown(Keys.H)) { _camera.Zoom -= _zoomIncrement; } if (ks.IsKeyDown(Keys.L)) { _camera.Zoom += _zoomIncrement; } break; } if (ks.IsKeyDown(Keys.P)) { State = CameraControlState.Position; } if (ks.IsKeyDown(Keys.Z)) { State = CameraControlState.Zoom; } if (ks.IsKeyDown(Keys.R)) { if (ks.IsKeyDown(Keys.LeftShift)) { _camera.Reset(); } else { State = CameraControlState.Rotation; } } }