mirror of
https://github.com/Fluffy-Bean/Again.git
synced 2025-05-14 13:12:16 +00:00
38 lines
738 B
C#
38 lines
738 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Diagnostics;
|
|
using UnityEngine;
|
|
using TMPro;
|
|
using UnityEngine.SceneManagement;
|
|
|
|
public class timerText : MonoBehaviour
|
|
{
|
|
|
|
TextMeshProUGUI textBox;
|
|
|
|
public float time = 0;
|
|
protected float Timer;
|
|
public int delayAmount = 1;
|
|
|
|
void Start()
|
|
{
|
|
textBox = GetComponent<TextMeshProUGUI>();
|
|
textBox.SetText("0");
|
|
}
|
|
|
|
void Update()
|
|
{
|
|
if (SceneManager.GetActiveScene().name == "game")
|
|
{
|
|
Timer += Time.deltaTime;
|
|
|
|
if (Timer >= delayAmount)
|
|
{
|
|
Timer = 0f;
|
|
time++;
|
|
textBox.SetText("{0}s", time);
|
|
PlayerPrefs.SetFloat("timeScore",time);
|
|
}
|
|
}
|
|
}
|
|
}
|