37 lines
724 B
C#
37 lines
724 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using TMPro;
|
|
public class TimerSk3 : MonoBehaviour
|
|
{
|
|
public TextMeshProUGUI mssg;
|
|
float timePlaying;
|
|
|
|
private bool gameOn;
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
timePlaying = 0;
|
|
gameOn = true;
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
if (gameOn)
|
|
{
|
|
timePlaying += Time.deltaTime;
|
|
|
|
int sec = (int)timePlaying % 60;
|
|
int min = (int)(timePlaying / 60);
|
|
|
|
mssg.text = string.Format("{0:00}:{1:00}", min, sec);
|
|
}
|
|
}
|
|
|
|
public void StopTimer()
|
|
{
|
|
gameOn = false;
|
|
}
|
|
}
|