20 lines
419 B
C#
20 lines
419 B
C#
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
using TMPro;
|
||
|
|
||
|
public class Timer : MonoBehaviour
|
||
|
{
|
||
|
public float timeRemaining;
|
||
|
public TextMeshProUGUI timeText;
|
||
|
|
||
|
//* Universal code for timers
|
||
|
void Update()
|
||
|
{
|
||
|
if (timeRemaining > 0)
|
||
|
{
|
||
|
timeRemaining -= Time.deltaTime;
|
||
|
timeText.text = timeRemaining.ToString("F0");
|
||
|
}
|
||
|
}
|
||
|
}
|