-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTimer.cs
44 lines (37 loc) · 1.05 KB
/
Timer.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using UnityEngine.SceneManagement;
public class Timer : MonoBehaviour
{
public Text timerText;
//private float startTime;
private float timeLeft = 300.0f;
private bool Finnished = false;
//// Use this for initialization
//void Start()
//{
// startTime = Time.time;
//}
// Update is called once per frame
void Update()
{
timeLeft -= Time.deltaTime;
timerText.text = "Time Left:" + Mathf.Round(timeLeft);
if (timeLeft < 0)
{
SceneManager.LoadScene("MainMenu");
}
// if (Finnished)
// return;
// float t = Time.time - startTime;
// string minutes = ((int)t / 60).ToString();
// string seconds = (t % 60).ToString("f2");
// timerText.text = minutes + ":" + seconds;
}
public void Finnish()
{
//Finnished = true;
//timerText.color = Color.yellow;
}
}