public void Update(ContinuousInputs inputs, GameTime gameTime) { var rotationDelta = gameTime.ElapsedGameTime.Milliseconds * MsToRadiansDeltaSpeed; if (inputs.TurnLeft) { _msToRadians -= rotationDelta; } else if (inputs.TurnRight) { _msToRadians += rotationDelta; } else if (inputs.Forward) { _msToRadians = 0; } if (inputs.ZoomIn) { var changeAmount = gameTime.ElapsedGameTime.Milliseconds * MsToGammaSpeed; ScreenBufferExtensions.GammaExponent += changeAmount; _message.ShowMessage($"Current gamma: {ScreenBufferExtensions.GammaExponent}"); } else if (inputs.ZoomOut) { var changeAmount = gameTime.ElapsedGameTime.Milliseconds * MsToGammaSpeed; ScreenBufferExtensions.GammaExponent -= changeAmount; _message.ShowMessage($"Current gamma: {ScreenBufferExtensions.GammaExponent}"); } var rotationRadians = gameTime.ElapsedGameTime.Milliseconds * _msToRadians; _angle += rotationRadians; }
private void EnqueueMovements(ContinuousInputs inputs, GameTime gameTime) { float inlineDistance = MovementSpeed * (float)gameTime.ElapsedGameTime.TotalMilliseconds; float rotationAmount = RotationSpeed * (float)gameTime.ElapsedGameTime.TotalMilliseconds; bool moved = false; Matrix4x4 movementMatrix = Matrix4x4.Identity; if (inputs.Forward) { moved = true; movementMatrix *= Matrix4x4.CreateTranslation(0, 0, inlineDistance); } else if (inputs.Backward) { moved = true; movementMatrix *= Matrix4x4.CreateTranslation(0, 0, -inlineDistance); } if (inputs.TurnRight) { moved = true; movementMatrix *= Matrix4x4.CreateRotationY(-rotationAmount); } else if (inputs.TurnLeft) { moved = true; movementMatrix *= Matrix4x4.CreateRotationY(rotationAmount); } if (moved) { EnqueueRenderChange(() => _camera.Transform *= movementMatrix); } }
public void Update(ContinuousInputs inputs, GameTime gameTime) { if (_size == Point.Zero) { return; } if (inputs.TurnLeft) { if (!_pressingLeft) { _pressingLeft = true; _killFire = true; } } else { _pressingLeft = false; } if (inputs.TurnRight) { if (!_pressingRight) { _pressingRight = true; InitializeFire(); } } else { _pressingRight = false; } if (gameTime.TotalGameTime - _lastUpdate > _updateFrequency) { _lastUpdate = gameTime.TotalGameTime; if (_killFire) { StopFire(); } UpdateFire(); } }
public void Update(ContinuousInputs inputs, GameTime gameTime) { var distance = gameTime.ElapsedGameTime.Milliseconds * MsToMoveSpeed; var rotationAmount = gameTime.ElapsedGameTime.Milliseconds * MsToRotateSpeed; if (inputs.Forward) { Move(ref Direction, distance); } else if (inputs.Backward) { var direction = new Vector2 { X = -Direction.X, Y = -Direction.Y }; Move(ref direction, distance); } if (inputs.StrafeLeft) { var direction = new Vector2 { X = -Direction.Y, Y = Direction.X }; Move(ref direction, distance); } else if (inputs.StrafeRight) { var direction = new Vector2 { X = Direction.Y, Y = -Direction.X }; Move(ref direction, distance); } if (inputs.TurnRight) { Rotate(-rotationAmount); } else if (inputs.TurnLeft) { Rotate(rotationAmount); } }
public void Update(ContinuousInputs inputs, GameTime gameTime) { if (!_settings.FollowMode) { var distance = gameTime.ElapsedGameTime.Milliseconds * MsToMoveSpeed / _camera.Zoom; if (inputs.Forward) { _camera.ViewOffset += Vector2.UnitY * distance; } else if (inputs.Backward) { _camera.ViewOffset -= Vector2.UnitY * distance; } if (inputs.TurnRight || inputs.StrafeRight) { _camera.ViewOffset += Vector2.UnitX * distance; } else if (inputs.TurnLeft || inputs.StrafeLeft) { _camera.ViewOffset -= Vector2.UnitX * distance; } } if (inputs.ZoomIn) { var zoomAmount = gameTime.ElapsedGameTime.Milliseconds * MsToZoomSpeed; _camera.Zoom = Math.Min(MaxMapToScreenRatio, _camera.Zoom * (1f + zoomAmount)); } else if (inputs.ZoomOut) { var zoomAmount = gameTime.ElapsedGameTime.Milliseconds * MsToZoomSpeed; _camera.Zoom = Math.Max(MinMapToScreenRatio, _camera.Zoom / (1f + zoomAmount)); } else if (inputs.ResetZoom) { _camera.Zoom = 1; } }
public void Update(ContinuousInputs inputs, GameTime gameTime) { var drawSpeedChangeDelta = gameTime.ElapsedGameTime.Milliseconds * MsToDrawSpeedDelta; if (inputs.ResetZoom) { _linesToDraw = 0; _msToDrawSpeed = DefaultMsToDrawSpeed; _screenMessage.ShowMessage($"Set speed to {_msToDrawSpeed}"); } else if (inputs.ZoomIn) { _msToDrawSpeed += drawSpeedChangeDelta; _screenMessage.ShowMessage($"Set speed to {_msToDrawSpeed}"); } else if (inputs.ZoomOut) { _msToDrawSpeed = Math.Max(0, _msToDrawSpeed - drawSpeedChangeDelta); _screenMessage.ShowMessage($"Set speed to {_msToDrawSpeed}"); } _linesToDraw = Math.Min(_map.Lines.Length, _linesToDraw + _msToDrawSpeed * gameTime.ElapsedGameTime.Milliseconds); }
public void Update(ContinuousInputs inputs, GameTime gameTime) { }
public void Update(ContinuousInputs inputs, GameTime gameTime) { _leftRenderer.Update(inputs, gameTime); _rightRenderer.Update(inputs, gameTime); }