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