mirror of
https://github.com/Fluffy-Bean/Again.git
synced 2025-07-01 13:36:17 +00:00
:3
This commit is contained in:
parent
90cf5a6112
commit
24501eac1e
13 changed files with 83 additions and 208 deletions
44
timerText.cs
44
timerText.cs
|
@ -8,31 +8,31 @@ using UnityEngine.SceneManagement;
|
|||
public class timerText : MonoBehaviour
|
||||
{
|
||||
|
||||
TextMeshProUGUI textBox;
|
||||
TextMeshProUGUI textBox;
|
||||
|
||||
public float time = 0;
|
||||
protected float Timer;
|
||||
public int delayAmount = 1;
|
||||
public float time = 0;
|
||||
protected float Timer;
|
||||
public int delayAmount = 1;
|
||||
|
||||
void Start()
|
||||
void Start()
|
||||
{
|
||||
textBox = GetComponent<TextMeshProUGUI>();
|
||||
textBox.SetText("0");
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (SceneManager.GetActiveScene().name == "game")
|
||||
{
|
||||
textBox = GetComponent<TextMeshProUGUI>();
|
||||
textBox.SetText("0");
|
||||
}
|
||||
Timer += Time.deltaTime;
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if (SceneManager.GetActiveScene().name == "game")
|
||||
{
|
||||
Timer += Time.deltaTime;
|
||||
|
||||
if (Timer >= delayAmount)
|
||||
{
|
||||
Timer = 0f;
|
||||
time++;
|
||||
textBox.SetText("{0}", time);
|
||||
}
|
||||
}
|
||||
if (Timer >= delayAmount)
|
||||
{
|
||||
Timer = 0f;
|
||||
time++;
|
||||
textBox.SetText("{0}s", time);
|
||||
PlayerPrefs.SetFloat("timeScore",time);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue