2024-04-21 02:09:30 +02:00
|
|
|
using Cinemachine;
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
public class TowerCam : MonoBehaviour
|
|
|
|
{
|
2024-04-21 03:22:56 +02:00
|
|
|
public GameObject m_gameObject;
|
2024-04-21 02:09:30 +02:00
|
|
|
|
|
|
|
private void Start()
|
|
|
|
{
|
|
|
|
if (m_gameObject == null)
|
|
|
|
m_gameObject = this.gameObject;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void ChangeToTarget(GameObject target)
|
|
|
|
{
|
|
|
|
if (target != null)
|
|
|
|
{
|
|
|
|
m_gameObject.GetComponent<CinemachineFreeLook>().m_LookAt = target.transform;
|
|
|
|
m_gameObject.GetComponent<CinemachineFreeLook>().m_Follow = target.transform;
|
|
|
|
m_gameObject.GetComponent<CinemachineFreeLook>().m_Priority = 11;
|
2024-04-21 03:22:56 +02:00
|
|
|
|
|
|
|
m_gameObject.GetComponent<CinemachineFreeLook>().GetRig(0).LookAt = target.transform;
|
|
|
|
m_gameObject.GetComponent<CinemachineFreeLook>().GetRig(1).LookAt = target.transform;
|
|
|
|
m_gameObject.GetComponent<CinemachineFreeLook>().GetRig(2).LookAt = target.transform;
|
2024-04-21 02:09:30 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_gameObject.GetComponent<CinemachineFreeLook>().m_Priority = 9;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|