Radar-Sichtbarkeitsgates, Hider-Pings im Seek + Ping-Countdown
Radar: nur sichtbar bei >=1 Target, in First-Person und in der Seek-Phase (Overlay-Kamera getoggelt, Blip-Skripte laufen weiter). Singleton fuer Server-Zugriff. GameModeManager: Kamera + Tab-Moduswechsel erst ab gebundenem Lobby-Player (Inert-Zustand ohne Player, Orbit-Input geparkt). MatchManager: Server tickt im Seek alle radarPingInterval (30s) und broadcastet noch nicht gefundene Hider (NetworkObjectId + radarPingLifetime 3s) nur an Hunter-Clients; jeder Hunter loest lokal auf und spawnt Blips. Ping-Loop in die Seek-Coroutine gefaltet (EndMatch stoppt ihn mit). MatchHud: Ping-Countdown lokal aus Seek-Start + Kadenz berechnet, Format m:ss (0:30..0:01), ausserhalb Seek / bei deaktivierten Pings 0:00. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
23b51d07a4
commit
de82ce25de
4 files changed
+240
-12
No files matched your search
@@ -24,6 +24,10 @@ public class MatchHud : MonoBehaviour
|
||||
[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;
|
||||
|
||||
@@ -31,6 +35,7 @@ public class MatchHud : MonoBehaviour
|
||||
[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);
|
||||
@@ -38,9 +43,9 @@ public class MatchHud : MonoBehaviour
|
||||
private void Awake()
|
||||
{
|
||||
if (!_canvas) _canvas = GetComponent<Canvas>();
|
||||
if (!_canvas || !_phaseText || !_timeText || !_crosshair || !_hunterCount || !_hiderCount)
|
||||
if (!_canvas || !_phaseText || !_timeText || !_pingTimeText || !_crosshair || !_hunterCount || !_hiderCount)
|
||||
{
|
||||
Debug.LogError("[MatchHud] Unwired reference(s) - assign Canvas/Phase/Time/Crosshair/HunterCount/HiderCount in the Inspector.", this);
|
||||
Debug.LogError("[MatchHud] Unwired reference(s) - assign Canvas/Phase/Time/PingTime/Crosshair/HunterCount/HiderCount in the Inspector.", this);
|
||||
enabled = false;
|
||||
return;
|
||||
}
|
||||
@@ -70,6 +75,15 @@ public class MatchHud : MonoBehaviour
|
||||
_timeText.text = $"{s / 60:0}:{s % 60:00}";
|
||||
}
|
||||
|
||||
// Next-radar-sweep countdown: shown for everyone during Seek (pings only fire then), 0:00 otherwise.
|
||||
bool showPing = phase == MatchManager.MatchSubPhase.Seek && match.RadarPingInterval > 0f;
|
||||
int p = showPing ? Mathf.CeilToInt(Mathf.Max(0f, match.LocalNextPingIn)) : 0;
|
||||
if (p != _lastPingSecond)
|
||||
{
|
||||
_lastPingSecond = p;
|
||||
_pingTimeText.text = $"{p / 60:0}:{p % 60:00}";
|
||||
}
|
||||
|
||||
NetworkPlayerSetup.CountRoles(out int hunters, out int hiders);
|
||||
if (hunters != _lastHunters)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user