Spaces:
Sleeping
Sleeping
Download project/Assets/Scripts/Game/DinoMatchUI.cs from alfarouqwebserver/SWS-Smarta: direct link, hf CLI and curl.
- Browser
- Download file 1.05 kB
-
https://huggingface.co/spaces/alfarouqwebserver/SWS-Smarta/resolve/main/project/Assets/Scripts/Game/DinoMatchUI.cs
- Command line
-
hf download hf://spaces/alfarouqwebserver/SWS-Smarta/project/Assets/Scripts/Game/DinoMatchUI.cs
-
curl -L -o DinoMatchUI.cs https://huggingface.co/spaces/alfarouqwebserver/SWS-Smarta/resolve/main/project/Assets/Scripts/Game/DinoMatchUI.cs
1.05 kB
| using TMPro; | |
| using UnityEngine; | |
| using UnityEngine.UI; | |
| public class DinoMatchUI : MonoBehaviour | |
| { | |
| public TMP_Text roundText; | |
| public TMP_Text stateText; | |
| public Text roundTextLegacy; | |
| public Text stateTextLegacy; | |
| public float updateInterval = 0.2f; | |
| float nextUpdate; | |
| void Update() | |
| { | |
| if (Time.time < nextUpdate) | |
| return; | |
| nextUpdate = Time.time + updateInterval; | |
| DinoGameManager gm = DinoGameManager.Instance; | |
| if (gm == null) | |
| return; | |
| SetText(roundText, roundTextLegacy, $"Round: {gm.CurrentRound}/{gm.maxRounds}"); | |
| string state; | |
| if (gm.IsMatchOver) state = "Match Over"; | |
| else if (gm.IsGameOver) state = "Round Over"; | |
| else if (!gm.IsGameStarted) state = "Ready"; | |
| else state = "Playing"; | |
| SetText(stateText, stateTextLegacy, state); | |
| } | |
| void SetText(TMP_Text tmp, Text legacy, string value) | |
| { | |
| if (tmp != null) tmp.text = value; | |
| if (legacy != null) legacy.text = value; | |
| } | |
| } | |