28 lines
713 B
C#
28 lines
713 B
C#
|
using Cinemachine;
|
||
|
using UnityEngine;
|
||
|
|
||
|
public class TowerCam : MonoBehaviour
|
||
|
{
|
||
|
private GameObject m_gameObject;
|
||
|
|
||
|
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;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
m_gameObject.GetComponent<CinemachineFreeLook>().m_Priority = 9;
|
||
|
}
|
||
|
}
|
||
|
}
|