-
Notifications
You must be signed in to change notification settings - Fork 0
/
time.cs
43 lines (39 loc) · 1014 Bytes
/
time.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
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class time : MonoBehaviour
{
// Start is called before the first frame update
public float timeStart = 60;
public GameObject flat;
public GameObject Flat2;
float score;
Vector3 fod;
Vector3 tor;
[SerializeField] Text timerText;
void Start()
{
timerText.text = timeStart.ToString();
tor = flat.transform.position;
score = tor[0];
Flat2.transform.position = fod;
}
// Update is called once per frame
void Update()
{
if (timeStart - Time.deltaTime > 0)
{
timeStart -= Time.deltaTime;
tor[2] = timeStart;
timerText.text = Mathf.Round(timeStart).ToString();
score = tor[0];
fod[0] = timeStart;
Flat2.transform.position = fod;
}
else
{
timerText.text = "Time's Up!".ToString();
}
}
}