29 lines
711 B
C#
29 lines
711 B
C#
|
using System;
|
||
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using Cinemachine;
|
||
|
using UnityEngine;
|
||
|
|
||
|
namespace BITKit.PlayerCamera
|
||
|
{
|
||
|
public class WorldCameraManager : MonoBehaviour
|
||
|
{
|
||
|
public static ICinemachineCamera ActiveCamera { get; private set; }
|
||
|
public static bool IsCameraActivated { get;internal set; }
|
||
|
[SerializeField] private CinemachineBrain brain;
|
||
|
|
||
|
[SerializeField] private LayerMask activeLayer;
|
||
|
[SerializeField] private LayerMask inactiveLayer;
|
||
|
private void Update()
|
||
|
{
|
||
|
ActiveCamera = brain.ActiveVirtualCamera;
|
||
|
brain.OutputCamera.cullingMask = IsCameraActivated ? activeLayer : inactiveLayer;
|
||
|
}
|
||
|
private void OnDestroy()
|
||
|
{
|
||
|
ActiveCamera = null;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|