using System; using UnityEngine; using UnityEngine.Serialization; namespace DefaultNamespace { public class PlayerCameraController : MonoBehaviour { [SerializeField] private Transform logicalCamera; [SerializeField] private Transform physicalCamera; [SerializeField] private Transform pivot; [SerializeField] private Transform minZoomTarget; [SerializeField] private Transform maxZoomTarget; private float _zoomAmount; /// /// Rotates the logical camera around the pivot by angle degrees. /// /// The amount to rotate, in degrees public void RotateAround(float angle) { logicalCamera.RotateAround(pivot.position, Vector3.up, angle); } /// /// Lerps the physical camera between the min zoom target and the max zoom target by the current zoom + amount /// /// public void Zoom(float amount) { _zoomAmount = Mathf.Clamp01(_zoomAmount + amount); physicalCamera.localPosition = Vector3.Lerp(minZoomTarget.localPosition, maxZoomTarget.localPosition, _zoomAmount); } } }