using Cinemachine; using Level; using UnityEngine; using UnityEngine.U2D; namespace Camera { public class CameraPlayerFinder : MonoBehaviour { private const float FollowOrthoSize = 7.5f; private const float FixedOrthoSize = 15f; private CinemachineVirtualCamera _cinemachineVirtualCamera; private PixelPerfectCamera pixelPerfectCamera = null; private void Awake() { _cinemachineVirtualCamera = GetComponent(); pixelPerfectCamera = GameObject.FindObjectOfType(); } private void Update() { if (LevelManager.Instance.CurrentLevel?.FixedCameraPoint == null) { if (_cinemachineVirtualCamera.Follow == null) { _cinemachineVirtualCamera.Follow = LevelManager.Instance.Player.transform; _cinemachineVirtualCamera.m_Lens.OrthographicSize = FollowOrthoSize; pixelPerfectCamera.enabled = false; } } else if (_cinemachineVirtualCamera.Follow != LevelManager.Instance.CurrentLevel.FixedCameraPoint) { _cinemachineVirtualCamera.Follow = LevelManager.Instance.CurrentLevel.FixedCameraPoint; // _cinemachineVirtualCamera.m_Lens.OrthographicSize = FixedOrthoSize; pixelPerfectCamera.enabled = true; } } } }