using TMPro; using UnityEngine; public class GameManager : MonoBehaviour { public static GameManager gameManager; public TextMeshProUGUI scoreText, timerText; public AudioSource gameWon; public float timeLeft = 120f; public bool gameRunning = true; private int currentScore = 0; void Awake() { gameManager = this; } void Update() { if (timeLeft > 0) { timeLeft -= Time.deltaTime; timerText.text = "Time: " + Mathf.Round(timeLeft) + "s"; if (timeLeft <= 0) gameWon.Play(); } else { gameRunning = false; timerText.text = ""; scoreText.text = "Total Score: " + currentScore; } } public void AddPoints() { currentScore += 10; scoreText.text = "Score: " + currentScore; } }