This commit is contained in:
Crizomb 2025-01-29 00:59:22 +01:00
parent a17810ffeb
commit 4e91f448c9
826 changed files with 66 additions and 8 deletions

40
Assets/Scripts/GameUI.cs Normal file
View file

@ -0,0 +1,40 @@
using System;
using TMPro;
using UnityEngine;
public class GameUI : MonoBehaviour
{
[SerializeField] TextMeshProUGUI timer;
public float time;
public bool timerActive;
[SerializeField] TextMeshProUGUI units;
private int enemiesLeft;
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
time = 0;
}
// Update is called once per frame
void Update()
{
if (timerActive)
{
time += Time.deltaTime;
}
TimeSpan displayedTime = TimeSpan.FromSeconds(time);
timer.text = displayedTime.Minutes.ToString() + displayedTime.Seconds.ToString();
enemiesLeft = GlobalsVariable.AliveUnitsTeamA.Count;
units.text = "Units Left: " + enemiesLeft.ToString();
}
}