|
|
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.SceneManagement;
- using UnityEngine.UI;
- using TMPro;
-
- public class HowToPlayController : MonoBehaviour
- {
- [SerializeField]
- private MaskableGraphic[] graphics;
-
- [SerializeField]
- private float fadeTime = 1.0f;
- [SerializeField]
- private float showTime = 3;
-
- [SerializeField]
- private string NextLevel = "Level 1";
-
- IEnumerator Start()
- {
-
-
- float elapsedTime = 0;
- Color color;
- while (elapsedTime < fadeTime)
- {
- foreach(MaskableGraphic g in graphics)
- {
- color = g.color;
- color.a = elapsedTime / fadeTime;
- g.color = color;
-
- yield return new WaitForEndOfFrame();
- elapsedTime += Time.deltaTime;
- }
- }
-
- foreach (MaskableGraphic g in graphics)
- {
- color = g.color;
- color.a = 1;
- g.color = color;
- }
-
- yield return new WaitForSeconds(showTime);
-
- elapsedTime = 0;
- while (elapsedTime < fadeTime)
- {
- foreach (MaskableGraphic g in graphics)
- {
- color = g.color;
- color.a = 1 - elapsedTime / fadeTime;
- g.color = color;
-
- yield return new WaitForEndOfFrame();
- elapsedTime += Time.deltaTime;
- }
- }
-
- foreach (MaskableGraphic g in graphics)
- {
- color = g.color;
- color.a = 0;
- g.color = color;
- }
-
- SceneManager.LoadScene(NextLevel);
- }
-
-
-
-
-
- }
|