61 lines
1.3 KiB
C#
61 lines
1.3 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class CameraControl : MonoBehaviour
|
|
{
|
|
public Camera[] cameras;
|
|
private int currentCameraIndex;
|
|
|
|
void Start ()
|
|
{
|
|
currentCameraIndex = 0;
|
|
|
|
|
|
for (int i=1; i<cameras.Length; i++)
|
|
{
|
|
cameras[i].gameObject.SetActive(false);
|
|
}
|
|
|
|
if (cameras.Length>0)
|
|
{
|
|
cameras [0].gameObject.SetActive (true);
|
|
}
|
|
}
|
|
|
|
|
|
void Update ()
|
|
{
|
|
|
|
if (Input.GetKeyDown(KeyCode.C))
|
|
{
|
|
Transition();
|
|
}
|
|
}
|
|
|
|
public void Transition()
|
|
{
|
|
//Play transition
|
|
ChangeCam();
|
|
}
|
|
|
|
|
|
public void ChangeCam()
|
|
{
|
|
currentCameraIndex ++;
|
|
|
|
if (currentCameraIndex < cameras.Length)
|
|
{
|
|
cameras[currentCameraIndex-1].gameObject.SetActive(false);
|
|
cameras[currentCameraIndex].gameObject.SetActive(true);
|
|
|
|
}
|
|
else
|
|
{
|
|
cameras[currentCameraIndex-1].gameObject.SetActive(false);
|
|
currentCameraIndex = 0;
|
|
cameras[currentCameraIndex].gameObject.SetActive(true);
|
|
|
|
}
|
|
}
|
|
} |