void Update() { // limit player speed if (player.velocity.magnitude > maxSpeed) { player.velocity = Vector3.ClampMagnitude(player.velocity, maxSpeed); } inputHorX = Input.GetAxis("Horizontal"); inputVertY = Input.GetAxis("Vertical"); // actual player update is performed in FixedUpdate if (Input.GetMouseButtonDown(0)) { _throwKeyPressedStartTime = Time.time; } if (Input.GetMouseButtonUp(0)) { // allows us to click the button while over it with the mouse if (EventSystem.current.IsPointerOverGameObject()) { return; } _ballActionHandler.ThrowBall(player.transform.position, player.transform.forward, _throwKeyPressedStartTime); } }
void Update() { float inputHorX = Input.GetAxis("Horizontal"); float inputVertY = Input.GetAxis("Vertical"); PlayerMovement(inputHorX, inputVertY); if (Input.GetMouseButtonDown(0)) { _throwKeyPressedStartTime = Time.time; } if (Input.GetMouseButtonUp(0)) { // allows us to click the button with over it with the mouse if (EventSystem.current.IsPointerOverGameObject()) { return; } _ballActionHandler.ThrowBall(player.transform.position, player.transform.forward, _throwKeyPressedStartTime); } }