private void Update() { IsFacingRight = _state.IsLookingRight; _state.IsGrounded = CheckIsOnGround(); grounded = _state.IsGrounded; CloseToGround(); ShieldThrowBlocked(); if (_state.IsGrounded && _jumpBuffered) { _jumpBuffered = false; // we need to stop the player's velocity because the rays extend below the box collider // if we don't stop all movement before doing the jump, the downward momentum will consume the // jump force and the player won't go back upwards after _state.IsGrounded gets set to true _playerMovement.ZeroYVelocity(); _playerMovement.OnJump(); } }