30 lines
623 B
C#
30 lines
623 B
C#
|
|
using UnityEngine;
|
|
using TMPro;
|
|
|
|
public class runningTime : MonoBehaviour
|
|
{
|
|
// Start is called before the first frame update
|
|
|
|
public TextMeshProUGUI allRunningTime;
|
|
public AudioSource bgMusicAudioSource;
|
|
|
|
private bool isPlayingSong = false;
|
|
|
|
void Start()
|
|
{
|
|
// allRunningTime.text = "0.00";
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
allRunningTime.text = Time.time.ToString("F2");
|
|
if (Time.time > 0 && isPlayingSong == false)
|
|
{
|
|
bgMusicAudioSource.Play(4);
|
|
isPlayingSong = true;
|
|
return;
|
|
}
|
|
}
|
|
} |