private void ResetState(MovementControllerState.Update update) { update.SetJump(false); update.SetMoveXAxis(0); update.SetMoveYAxis(0); update.SetRun(false); update.SetTurnYAxis(0); }
private void Update() { var update = new MovementControllerState.Update(); // Clear the state on every frame ResetState(update); if (MouseMove.Check()) { update.SetMoveYAxis(1.0f); update.SetTurnYAxis(Input.GetAxis("Mouse X")); } else if (MouseTurn.Check()) { update.SetTurnYAxis(Input.GetAxis("Mouse X")); } if (Forward.Check()) { update.SetMoveYAxis(1.0f); } else if (Backward.Check()) { update.SetMoveYAxis(-1.0f); } if (StrafeLeft.Check()) { update.SetMoveXAxis(-1.0f); } else if (StrafeRight.Check()) { update.SetMoveXAxis(1.0f); } if (TurnLeft.Check()) { update.SetTurnYAxis(-1.0f); } else if (TurnRight.Check()) { update.SetTurnYAxis(1.0f); } RunModifier.CheckAsync(() => update.SetRun(true)); Jump.CheckAsync(() => update.SetJump(true)); controller.Send(update); }