This commit is contained in:
Michał Gdula 2022-05-15 00:03:31 +01:00
parent 90cf5a6112
commit 24501eac1e
13 changed files with 83 additions and 208 deletions

View file

@ -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);
}
}
}
}