using TMPro;
using UnityEngine;
///
/// Binds the authored MatchHudCanvas widgets to live match state (sub-phase + countdowns, role
/// counts, hunter crosshair); creates nothing at runtime. Passive overlay: the canvas has no
/// and every graphic is raycastTarget=false, and its
/// sortingOrder (90) sits below PaintHud's (100) so tool panels always win. There is no change event for
/// the phase/timer, so values are polled per frame; the visible strings are only rebuilt when the
/// displayed second / phase actually changes.
///
[DisallowMultipleComponent]
public class MatchHud : MonoBehaviour
{
[Tooltip("HUD canvas, toggled with the match. Empty = the Canvas on this GameObject.")]
[SerializeField] private Canvas _canvas;
[Tooltip("Sub-phase label in the top bar.")]
[SerializeField] private TMP_Text _phaseText;
[Tooltip("Countdown label in the top bar.")]
[SerializeField] private TMP_Text _timeText;
[Tooltip("Seconds until the next radar ping sweep; counts down from the interval and repeats. Shown only " +
"during the seek phase (blank otherwise).")]
[SerializeField] private TMP_Text _pingTimeText;
[SerializeField] private TMP_Text _hunterCount;
[SerializeField] private TMP_Text _hiderCount;
[Tooltip("Crosshair, shown only for the hunter during the seek phase.")]
[SerializeField] private GameObject _crosshair;
private int _lastSecond = -1;
private int _lastPingSecond = -1;
private int _lastHunters = -1;
private int _lastHiders = -1;
private MatchManager.MatchSubPhase _lastPhase = (MatchManager.MatchSubPhase)(-1);
private void Awake()
{
if (!_canvas) _canvas = GetComponent