void PlayerInput() { if (PlayerEnabled) { float sw = Input.GetAxis("Mouse ScrollWheel"); if (sw != 0) { DigSizeClick = Mathf.Clamp(DigSizeClick + 0.5f * sw, 1.5f, 8f); DigSize = Mathf.Floor(DigSizeClick * 10) / 10.0f; } moveInput.x = Input.GetAxisRaw("Horizontal"); moveInput.y = Input.GetAxisRaw("Vertical"); mc.InputMove = moveInput; mc.InputJump |= Input.GetButton("Jump"); mc.InputSprint = Input.GetButton("Sprint"); if (Input.GetButton("Fire1")) { if (digIntervalTimer <= 0 && !IsOverHeating) { Dig(); } } if (Input.GetButtonDown("Fire2")) { if (InRangeState != InRange.Nothing && GrappleTimer >= grappleInterval) { grapplingHook.Grapple(hit.point); } } else if (Input.GetButtonUp("Fire2") && grapplingHook.isGrappled) { GrappleTimer = 0; grapplingHook.UnGrapple(); } if (Input.GetButtonDown("Interact") && InRangeState == InRange.Interactible) { hit.collider.GetComponent <Interactible>().Interact(); } if (Input.GetButtonDown("Sonar")) { OnListenSonar?.Invoke(this); } else if (Input.GetButtonUp("Sonar")) { OnStopListenSonar?.Invoke(this); } } }