using UnityEngine;

public class CameraSwitch : MonoBehaviour
{
    public GameObject camera1;
    public GameObject camera2;

    void Start()
    {
        camera1.SetActive(true);
        camera2.SetActive(false);
    }

    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Alpha1))
        {
            SwitchCamera(1);
        }

        if (Input.GetKeyDown(KeyCode.Alpha2))
        {
            SwitchCamera(2);
        }
    }

    void SwitchCamera(int camNumber)
    {
        if (camNumber == 1)
        {
            camera1.SetActive(true);
            camera2.SetActive(false);
        }
        else if (camNumber == 2)
        {
            camera1.SetActive(false);
            camera2.SetActive(true);
        }
    }

    public void Camera2Button()
    {
        SwitchCamera(2);
    }

    public void Camera1Button()
    {
        SwitchCamera(1);
    }
}