using UnityEngine; using UnityEngine.UI; using TMPro; public class BalloonGameManager : MonoBehaviour { public CameraScroller cameraScroller; public GameObject gameOverPanel; public TextMeshProUGUI scoreTextInGame; public TextMeshProUGUI scoreTextGameOver; public GameObject balloon; // Assign your Balloon object here private float score = 0f; private bool gameOver = false; public static bool IsGameOver { get; private set; } = false; void Update() { if (BalloonGameManager.IsGameOver) return; // Score increases with time score += Time.deltaTime; if (scoreTextInGame != null) scoreTextInGame.text = "Score: "+Mathf.FloorToInt(score).ToString(); } public void TriggerGameOver() { if (IsGameOver) return; IsGameOver = true; if (cameraScroller != null) cameraScroller.enabled = false; if (gameOverPanel != null) gameOverPanel.SetActive(true); if (scoreTextGameOver != null) scoreTextGameOver.text = "Score: " + Mathf.FloorToInt(score).ToString(); } }