End Screen & Fix layers collision bug
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
[RequireComponent(typeof(CanvasGroup))]
|
||||
public class DeathScreen : MonoBehaviour
|
||||
{
|
||||
private CanvasGroup _cg;
|
||||
private void Start()
|
||||
{
|
||||
_cg = GetComponent<CanvasGroup>();
|
||||
}
|
||||
|
||||
public void ShowScreen()
|
||||
{
|
||||
StartCoroutine(IShowScreen());
|
||||
}
|
||||
|
||||
private IEnumerator IShowScreen()
|
||||
{
|
||||
for(float i = 0; i < 1; i += 0.01f)
|
||||
{
|
||||
_cg.alpha += i;
|
||||
yield return new WaitForSecondsRealtime(0.02f);
|
||||
}
|
||||
yield return new WaitForSecondsRealtime(2f);
|
||||
SceneManager.LoadScene("End");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user