Add Game Over screen and count down clock for game time
This commit is contained in:
parent
15abaa80fa
commit
0c71d06fb8
10 changed files with 934 additions and 9 deletions
45
Assets/Scripts/UI/GameOverUI.cs
Normal file
45
Assets/Scripts/UI/GameOverUI.cs
Normal file
|
@ -0,0 +1,45 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
public class GameOverUI : MonoBehaviour
|
||||
{
|
||||
|
||||
[SerializeField] private TextMeshProUGUI recipesDeliveredText;
|
||||
|
||||
|
||||
private void Start()
|
||||
{
|
||||
GameStateManager.Instace.OnStateChanged += GameStateManager_OnStateChanged;
|
||||
|
||||
Hide();
|
||||
}
|
||||
|
||||
private void GameStateManager_OnStateChanged(object sender, System.EventArgs e)
|
||||
{
|
||||
|
||||
if (GameStateManager.Instace.IsGameOver())
|
||||
{
|
||||
recipesDeliveredText.text = DeliveryManager.Instance.GetSuccessfulRecipesAmount().ToString();
|
||||
|
||||
Show();
|
||||
}
|
||||
else
|
||||
{
|
||||
Hide();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void Show()
|
||||
{
|
||||
gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
private void Hide()
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
}
|
Reference in a new issue