using TMPro; using UnityEngine; using UnityEngine.UI; public class GamePlayingClockUI : MonoBehaviour { public static GamePlayingClockUI Instance { get; private set; } [SerializeField] private Image timerImage; [SerializeField] private TextMeshProUGUI timerText; private void Awake() => Instance = this; private void Start() { Show(); } private void Update() { float playingTimeNormalized = KitchenGameManager.Instance.GetGamePlayingTimerNormalized(); timerImage.fillAmount = playingTimeNormalized; timerImage.color = Color.Lerp(Color.green, Color.red, playingTimeNormalized); int timeLeft = Mathf.CeilToInt(KitchenGameManager.Instance.GamePlayingTimer); timerText.text = timeLeft.ToString(); } public void Hide() => gameObject.SetActive(false); public void Show() => gameObject.SetActive(true); }