| 1234567891011121314151617181920212223 |
- using TMPro;
- using UnityEngine;
- public class Timer : MonoBehaviour
- {
- [SerializeField] float timerTime = 60.00f;
- [SerializeField] TextMeshProUGUI timerText;
- private void Update()
- {
- if(GameManager.gameManagerInstance.gameState == GameManager.GameState.Playing)
- {
- timerTime -= Time.deltaTime;
- timerText.text = timerTime.ToString();
- if(timerTime < 0)
- {
- GameManager.gameManagerInstance.gameState = GameManager.GameState.GameOver;
- }
- }
- }
- }
|