Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Create timeText in Hierarchy,
- //in game manager.cs
- public TextMeshProUGUI timeText;
- private float timeDown = 30;
- public void UpdateTime()
- {
- if(isGameActive)
- {
- timeDown -= Time.deltaTime;
- timeText.text = "Time: " + Mathf.Round(timeDown);
- if(timeDown <= 0)
- {
- GameOver();
- }
- }
- }
- private void Update()
- {
- UpdateTime();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement