41 lines
858 B
C#
Raw Normal View History

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/*
Static Class which takes role of Controller for all the Cameras/Triggers
IMPORTANT!!!
The Priority of the FIRST Camera that should be shown has to be set manually to 100
The Priorities of the OTHER cameras can be anything else then 100
IMPORTANT!!!
*/
public static class CameraController
{
public static Camera currentCam;
static List<Camera> cameras = new List<Camera>();
public static void Register(Camera cam)
{
cameras.Add(cam);
}
public static void ActivateCamera(Camera cam)
{
cam.depth = 100;
currentCam = cam;
foreach (Camera c in cameras)
{
if(c != currentCam) c.depth = 0;
}
}
public static Camera CurrentCamera()
{
return currentCam;
}
}