using TMPro; using UnityEngine; namespace GameEngineI.Week07 { // Period 1: display Week 5's existing collection count; do not own a second score. public sealed class Week07HudDisplay : MonoBehaviour { [SerializeField] PlayerProgress progress; [SerializeField] TMP_Text scoreText; [SerializeField] TMP_Text timerText; [SerializeField, Min(1)] float roundDuration = 30f; public float TimeRemaining { get; private set; } void Start() { TimeRemaining = roundDuration; RefreshHud(); } void Update() { TimeRemaining = Mathf.Max(0, TimeRemaining - Time.deltaTime); RefreshHud(); } void RefreshHud() { scoreText.text = $"{progress.GetCollectedCount()} / {progress.GetRequiredCollectibles()}"; timerText.text = $"{TimeRemaining:0.0}"; } } }