Add basic intro countdown and game states

This commit is contained in:
BuyMyMojo 2023-03-03 09:13:47 +11:00
parent 89e482d387
commit 15abaa80fa
10 changed files with 740 additions and 6 deletions

View file

@ -0,0 +1,45 @@
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
public class GameStartCountdownUI : MonoBehaviour
{
[SerializeField] private TextMeshProUGUI countdownText;
private void Start()
{
GameStateManager.Instace.OnStateChanged += GameStateManager_OnStateChanged;
Hide();
}
private void GameStateManager_OnStateChanged(object sender, System.EventArgs e)
{
if (GameStateManager.Instace.IsCountdownToStartActive())
{
Show();
} else
{
Hide();
}
}
private void Update()
{
countdownText.text = Mathf.Ceil(GameStateManager.Instace.GetCountdownToStartTimer()).ToString();
}
private void Show()
{
gameObject.SetActive(true);
}
private void Hide()
{
gameObject.SetActive(false);
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2e210821ea09ba64fa474a98e4760bcb
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: