using Cinemachine; using UnityEngine; public class TowerCam : MonoBehaviour { [SerializeField] private GameObject m_gameObject; public GameObject newTarget; private void Start() { if (m_gameObject == null) m_gameObject = this.gameObject; } public void ChangeToTarget(GameObject target) { float originalOffset = m_gameObject.GetComponent().m_Offset.z; if (target != null) { newTarget = target; m_gameObject.GetComponent().m_LookAt = target.transform; m_gameObject.GetComponent().m_Follow = target.transform; m_gameObject.GetComponent().m_Priority = 11; m_gameObject.GetComponent().GetRig(0).LookAt = target.transform; m_gameObject.GetComponent().GetRig(1).LookAt = target.transform; m_gameObject.GetComponent().GetRig(2).LookAt = target.transform; m_gameObject.GetComponent().m_Offset.z = 0; } else { m_gameObject.GetComponent().m_Priority = 9; m_gameObject.GetComponent().m_Offset.z = originalOffset; } } }