Spaces:
Sleeping
Sleeping
Download project/Assets/Scripts/Game/DinoCountdownUI.cs from alfarouqwebserver/SWS-Smarta: direct link, hf CLI and curl.
- Browser
- Download file 979 Bytes
-
https://huggingface.co/spaces/alfarouqwebserver/SWS-Smarta/resolve/main/project/Assets/Scripts/Game/DinoCountdownUI.cs
- Command line
-
hf download hf://spaces/alfarouqwebserver/SWS-Smarta/project/Assets/Scripts/Game/DinoCountdownUI.cs
-
curl -L -o DinoCountdownUI.cs https://huggingface.co/spaces/alfarouqwebserver/SWS-Smarta/resolve/main/project/Assets/Scripts/Game/DinoCountdownUI.cs
979 Bytes
| using TMPro; | |
| using UnityEngine; | |
| using UnityEngine.UI; | |
| public class DinoCountdownUI : MonoBehaviour | |
| { | |
| public TMP_Text countdownText; | |
| public Text countdownTextLegacy; | |
| public float hideDelay = 0.75f; | |
| float goTime = -1f; | |
| void Update() | |
| { | |
| DinoGameManager gm = DinoGameManager.Instance; | |
| if (gm == null) | |
| return; | |
| if (gm.IsGameStarted) | |
| { | |
| if (goTime < 0f) | |
| goTime = Time.time; | |
| if (Time.time - goTime > hideDelay) | |
| { | |
| SetText(""); | |
| return; | |
| } | |
| SetText("GO!"); | |
| return; | |
| } | |
| float remaining = gm.GetCountdownRemaining(); | |
| int sec = Mathf.CeilToInt(remaining); | |
| SetText(sec.ToString()); | |
| } | |
| void SetText(string value) | |
| { | |
| if (countdownText != null) countdownText.text = value; | |
| if (countdownTextLegacy != null) countdownTextLegacy.text = value; | |
| } | |
| } | |