public void Update(GameTime gameTime) { var currentMouseState = Mouse.GetState(); var movementDirection = Vector3.Zero; if (_inputSystem.Left(InputDetectionType.HeldDown, DirectionalInputTypes.WASD | DirectionalInputTypes.LeftThumbstick)) { movementDirection.X = -1.0f; } else if (_inputSystem.Right(InputDetectionType.HeldDown, DirectionalInputTypes.WASD | DirectionalInputTypes.LeftThumbstick)) { movementDirection.X = 1.0f; } if (_inputSystem.Up(InputDetectionType.HeldDown, DirectionalInputTypes.WASD | DirectionalInputTypes.LeftThumbstick)) { movementDirection.Z = 1.0f; } else if (_inputSystem.Down(InputDetectionType.HeldDown, DirectionalInputTypes.WASD | DirectionalInputTypes.LeftThumbstick)) { movementDirection.Z = -1.0f; } switch (MovementMode) { case PlayerMovementMode.FirstPerson: HandleFirstPersonMovement(gameTime.GetSeconds(), currentMouseState, movementDirection); break; case PlayerMovementMode.ThirdPerson: HandleThirdPersonMovement(gameTime.GetSeconds(), currentMouseState, movementDirection); break; case PlayerMovementMode.GodMode: HandleGodModeMovement(gameTime.GetSeconds(), currentMouseState, movementDirection); break; } _mouseState = currentMouseState; if (MovementMode != PlayerMovementMode.GodMode) { if (Math.Abs(_cameraTargetPosition.Z - _cameraEntity.Position.Z) > float.Epsilon) { _cameraEntity.Position = new Vector3(_cameraEntity.Position.X, _cameraEntity.Position.Y, MathHelper.SmoothStep(_cameraEntity.Position.Z, _cameraTargetPosition.Z, 0.2f)); } if (Math.Abs(_cameraTargetPosition.Y - _cameraEntity.Position.Y) > float.Epsilon) { _cameraEntity.Position = new Vector3(_cameraEntity.Position.X, MathHelper.SmoothStep(_cameraEntity.Position.Y, _cameraTargetPosition.Y, 0.2f), _cameraEntity.Position.Z); } } }
public override void Update(UiFocusContainer container) { if (_inputSystem.Up(InputDetectionType.PressedOnce, DirectionalInputTypes.All)) { InvokeMoveToPreviousElement(); } if (_inputSystem.Down(InputDetectionType.PressedOnce, DirectionalInputTypes.All)) { InvokeMoveToNextElement(); } if (_inputSystem.Accept(AcceptInputTypes.Buttons)) { InvokeAction(container.CurrentElement); } }