using UnityEngine;
using Unity.Cinemachine;

public class CameraSystem : MonoBehaviour
{
    [SerializeField] private CinemachineCamera outerVcam;
    [SerializeField] private CinemachineCamera innerVcam;

    [Header("Toggle")]
    [SerializeField] private KeyCode toggleKey = KeyCode.E;
    [SerializeField] private int activePriority = 20;
    [SerializeField] private int inactivePriority = 10;

    private bool _outerActive = true;

    private void Start()
    {
        SetOuterActive(true);
    }

    private void Update()
    {
        if (Input.GetKeyDown(toggleKey))
            SetOuterActive(!_outerActive);
    }

    private void SetOuterActive(bool active)
    {
        _outerActive = active;

        outerVcam.Priority = active ? activePriority : inactivePriority;
        innerVcam.Priority = active ? inactivePriority : activePriority;
    }
}