24 lines
373 B
C#
24 lines
373 B
C#
using System;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
|
|
public class GameTimer : MonoBehaviour {
|
|
TMP_Text label;
|
|
float timer;
|
|
public bool stopped;
|
|
|
|
void Awake() {
|
|
label = GetComponent<TMP_Text>();
|
|
timer = 0f;
|
|
stopped = true;
|
|
}
|
|
|
|
void Update() {
|
|
if (stopped)
|
|
return;
|
|
|
|
timer += Time.deltaTime;
|
|
label.text = TimeSpan.FromSeconds(timer)
|
|
.ToString(@"mm\:ss");
|
|
}
|
|
} |