HeavenStudioPlus/Assets/Scripts/UI/Prologue.cs

39 lines
1.0 KiB
C#
Raw Normal View History

2021-12-19 04:10:43 +00:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
2021-12-21 01:10:49 +00:00
namespace RhythmHeavenMania
2021-12-19 04:10:43 +00:00
{
2021-12-21 01:10:49 +00:00
public class Prologue : MonoBehaviour
{
[SerializeField] private float waitSeconds;
2021-12-19 04:10:43 +00:00
2021-12-21 01:10:49 +00:00
public GameObject Holder;
public GameObject pressAny;
2021-12-19 04:10:43 +00:00
2021-12-21 01:10:49 +00:00
bool inPrologue = false;
2021-12-19 04:10:43 +00:00
2021-12-21 01:10:49 +00:00
private void Update()
2021-12-19 04:10:43 +00:00
{
2021-12-21 01:10:49 +00:00
if (Input.anyKeyDown && !inPrologue)
{
pressAny.SetActive(false);
Holder.SetActive(true);
StartCoroutine(Wait());
inPrologue = true;
}
2021-12-19 04:10:43 +00:00
}
2021-12-21 01:10:49 +00:00
IEnumerator Wait()
{
transform.GetChild(0).gameObject.SetActive(false);
yield return new WaitForSeconds(1);
transform.GetChild(0).gameObject.SetActive(true);
yield return new WaitForSeconds(waitSeconds);
transform.GetChild(0).gameObject.SetActive(false);
yield return new WaitForSeconds(2);
UnityEngine.SceneManagement.SceneManager.LoadScene(1);
}
2021-12-19 04:10:43 +00:00
}
2021-12-21 01:10:49 +00:00
}