MiniGames/Assets/Scripts/BerryBullsEye/BullsEyeGameManager.cs

43 lines
804 B
C#
Raw Permalink Normal View History

2025-07-11 15:42:48 +05:00
using UnityEngine;
using UnityEngine.UI;
using TMPro;
public class BullsEyeGameManager : MonoBehaviour
{
public static BullsEyeGameManager Instance;
public int score = 0;
public float timeLimit = 60f;
public TextMeshProUGUI scoreText;
public TextMeshProUGUI timerText;
2025-07-15 22:16:23 +05:00
2025-07-11 15:42:48 +05:00
private float timer;
void Awake()
{
Instance = this;
timer = timeLimit;
}
void Update()
{
if (timer > 0)
{
timer -= Time.deltaTime;
timerText.text = "Time: " + Mathf.Ceil(timer).ToString();
}
else
{
timerText.text = "Time: 0";
// Optional: Trigger game over
}
}
public void AddScore()
{
score++;
scoreText.text = "Score: " + score;
}
}