You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
MiniGames/Assets/BullsEyeGameManager.cs

42 lines
799 B
C#

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;
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;
}
}