forked from zxl/LaboratoryProtection
40 lines
872 B
C#
40 lines
872 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using Sirenix.OdinInspector;
|
|
using UnityEngine;
|
|
|
|
namespace UnityTest.ZXL
|
|
{
|
|
public class CameraManager : BaseAutoMono<CameraManager>
|
|
{
|
|
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
|
|
}
|
|
} |