using DefaultNamespace; using UnityEngine; using UnityEngine.InputSystem; namespace Input { public class PlayerCameraInputHandler : MonoBehaviour { [SerializeField] private PlayerCameraController cameraController; [SerializeField] [Range(0, 100)] private float rotationSensitivity; [SerializeField] [Range(0, 1)] private float zoomSensitivity; private bool _allowRotation; public void OnInputZoom(InputAction.CallbackContext context) { var input = context.ReadValue(); var zoomAmount = input * zoomSensitivity * Time.deltaTime; cameraController.Zoom(zoomAmount); } public void OnInputRotate(InputAction.CallbackContext context) { if (context.phase != InputActionPhase.Performed) return; if (!_allowRotation) return; var input = context.ReadValue(); var rotationAmount = input * rotationSensitivity * Time.deltaTime; cameraController.RotateAround(rotationAmount); } public void OnInputHoldToRotate(InputAction.CallbackContext context) { _allowRotation = context.phase switch { InputActionPhase.Performed => true, _ => false }; } } }