using RR.Game2D.Core; using Unity.Cinemachine; using UnityEngine; public class CinemachineFindPlayer : MonoBehaviour { //[Header("Параметры смещения")] //[SerializeField] float interpolationTime = 10f; private GameObject tPlayer; private Transform tFollowTarget; private CinemachineCamera vcam; //private CinemachineFollow followScript; //private bool playerFacedLeft = false; void Start() { vcam = GetComponent(); //followScript = GetComponent(); if (tPlayer == null) { tPlayer = GameManager.Instance.PlayerObj; if (tPlayer == null) tPlayer = GameObject.FindWithTag("Player"); } } void FixedUpdate() { if (tPlayer != null) { tFollowTarget = tPlayer.transform; vcam.LookAt = tFollowTarget; vcam.Follow = tFollowTarget; //playerFacedLeft = Mathf.Abs(tPlayer.transform.localEulerAngles.y) >= 180f; ////Debug.Log($"Faced left: {playerFacedLeft}"); //Vector3 cameraOffset = followScript.FollowOffset; //cameraOffset.x = playerFacedLeft ? -offset.x : offset.x; //followScript.FollowOffset = Vector3.Lerp(followScript.FollowOffset, cameraOffset, Time.deltaTime); } } }