Hide hider nameplates from hunters during seek phase

Generalize the body-renderer gate to all avatars so nameplates inherit
the existing visibility matrix (hide phase, found hiders, paint reveal,
conversion settle), and add the one case the body gate cannot cover:
hunters see camouflaged hider bodies during seek, so suppress hider
names for a local hunter viewer while LocalSubPhase == Seek.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
adminandClaude Fable 5 committed 2026-07-08 15:05:48 +02:00
1 parent 553db9a088
commit 262a20326a
1 file changed
+16 -5
+16 -5
View File
@@ -7,9 +7,10 @@ using UnityEngine;
/// projected above the head via Camera.main each LateUpdate - NOT world-space, so names always draw over the
/// scene and (via this canvas's sortingOrder) over the normal HUD. No GraphicRaycaster and every label is
/// raycastTarget=false, so it never eats clicks. Font size scales inversely with camera distance, clamped to
/// [minFontSize, maxFontSize]. The OWN avatar's label is gated on its body being locally rendered - the exact
/// proxy for "not first-person" (the FP controller self-hides the mesh, including while Esc-paused).
/// Per-role/phase visibility (hide phase etc.) is deliberately not applied yet.
/// [minFontSize, maxFontSize]. Visibility: a label shows only while its avatar's body is rendered locally
/// (own first-person self-hide, the per-client hide-phase matrix, found hiders, paint-reveal gate - a name
/// floating over an invisible body would leak the position), and hider names are additionally suppressed for
/// a local HUNTER viewer during Seek, where bodies ARE rendered but a label would defeat the camouflage hunt.
/// </summary>
[DisallowMultipleComponent]
public class PlayerNameplates : MonoBehaviour
@@ -63,6 +64,12 @@ public class PlayerNameplates : MonoBehaviour
}
var cam = Camera.main;
// Seek is the one window where a hider's body is rendered for a hunter but its name must not be
// (spotting the camouflage IS the game); everywhere else the body-rendered gate below suffices.
var match = MatchManager.Instance;
bool hunterSeek = match && match.LocalSubPhase == MatchManager.MatchSubPhase.Seek &&
NetworkPlayerSetup.LocalViewerIsHunter();
for (int i = 0; i < _entries.Count; i++)
{
Entry e = _entries[i];
@@ -70,8 +77,12 @@ public class PlayerNameplates : MonoBehaviour
bool show = cam;
// Own avatar: label only while the body is rendered locally (hidden = first person / load freeze).
if (show && e.setup.IsOwner && (!e.body || !e.body.enabled))
// Label only while the body is rendered locally: covers the own first-person self-hide AND every
// per-client hide (hide-phase matrix, found hiders, paint-reveal/conversion gates) in one check.
if (show && (!e.body || !e.body.enabled))
show = false;
if (show && hunterSeek && e.setup.Role == PlayerRole.Hider)
show = false;
Vector3 screen = default;