34 lines
932 B
C#
34 lines
932 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine.SceneManagement;
|
|
using UnityEngine;
|
|
|
|
public class IntroController : MonoBehaviour
|
|
{
|
|
[SerializeField] List<IntroFadeController> faders;
|
|
[SerializeField] string nextSceneName;
|
|
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
Cursor.visible = false;
|
|
if (faders.Count > 0) {
|
|
faders[0].gameObject.SetActive(true);
|
|
}
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
if (faders.Count == 0) {
|
|
SceneManager.LoadScene(nextSceneName, LoadSceneMode.Single);
|
|
} else if (!faders[0].gameObject.activeSelf) {
|
|
// Start the timer of a new fader.
|
|
faders[0].gameObject.SetActive(true);
|
|
} else if (faders[0].turnedOff) {
|
|
faders[0].gameObject.SetActive(false);
|
|
faders.RemoveAt(0);
|
|
}
|
|
}
|
|
}
|