2023-09-25 02:08:58 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using Sirenix.OdinInspector;
|
|
|
|
|
using UnityEngine;
|
2023-09-12 23:18:01 +08:00
|
|
|
|
|
|
|
|
|
namespace UnityTest.ZXL
|
|
|
|
|
{
|
2023-09-13 15:04:19 +08:00
|
|
|
|
public class CameraManager : BaseAutoMono<CameraManager>
|
2023-09-12 23:18:01 +08:00
|
|
|
|
{
|
2023-09-25 02:08:58 +08:00
|
|
|
|
public List<Camera> cameras = new List<Camera>();
|
|
|
|
|
public Camera current;
|
|
|
|
|
|
|
|
|
|
private void Update()
|
|
|
|
|
{
|
|
|
|
|
current = GetCurrentCamera();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Camera GetCurrentCamera()
|
|
|
|
|
{
|
|
|
|
|
foreach (var camera1 in cameras)
|
|
|
|
|
{
|
|
|
|
|
if (camera1.gameObject.activeSelf)
|
|
|
|
|
{
|
|
|
|
|
return camera1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#if UNITY_EDITOR
|
|
|
|
|
[Button]
|
|
|
|
|
void Add(Transform timeline_M)
|
|
|
|
|
{
|
|
|
|
|
var list = timeline_M.gameObject.GetComponentAllChild<Camera>();
|
|
|
|
|
cameras = list;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
2023-09-12 23:18:01 +08:00
|
|
|
|
}
|
|
|
|
|
}
|