Cute_demon_attacks/meng_yao/Assets/script/TanChuang/Virtual_CameraManager.cs

57 lines
1.3 KiB
C#
Raw Normal View History

2024-11-09 00:00:46 +08:00
using Cinemachine;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Virtual_CameraManager : MonoBehaviour
{
public static Virtual_CameraManager Instance;
public List<CinemachineVirtualCamera> Cameralist = new List<CinemachineVirtualCamera>();
public List<Canvas> Canvaslist = new List<Canvas>();
// Start is called before the first frame update
void Start()
{
Instance = this;
// ȷ<><C8B7>ֻ<EFBFBD>е<EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ã<EFBFBD><C3A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
for (int i = 0; i < Cameralist.Count; i++)
{
Cameralist[i].Priority = (i == 0) ? 10 : 0;
}
HideCanvas();
}
// Update is called once per frame
void Update()
{
}
public void SwitchToCamera(int cameraIndex)
{
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȼ<EFBFBD><C8BC><EFBFBD><EFBFBD><EFBFBD>
for (int i = 0; i < Cameralist.Count; i++)
{
Cameralist[i].Priority = 0;
}
// <20><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȼ<EFBFBD>
Cameralist[cameraIndex].Priority = 10;
HideCanvas();
Canvaslist[cameraIndex].gameObject.SetActive(true);
Debug.Log($"<22>л<EFBFBD><D0BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> {cameraIndex + 1}");
}
void HideCanvas()
{
for (int i = 0; i < Canvaslist.Count; i++)
{
Canvaslist[i].gameObject.SetActive(false);
}
}
}