using System.Collections; using System.Collections.Generic; using UnityEngine; using Cinemachine; public class ChangeCamera : MonoBehaviour { private int _priority = 0; // Start is called before the first frame update void Start() { } private void OnTriggerEnter(Collider other) { Role role = other.gameObject.GetComponent(); if(!role || !role.IsTeamLeader) { return; } CinemachineVirtualCamera cine = this.GetComponent(); if(this._priority >= 100) { return; } this._priority = cine.Priority; cine.Priority += 100; } private void OnTriggerExit(Collider other) { Role role = other.gameObject.GetComponent(); if (!role || !role.IsTeamLeader) { return; } CinemachineVirtualCamera cine = this.GetComponent(); cine.Priority = this._priority; } }