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:
1 parent
553db9a088
commit
262a20326a
1 file changed
+16
-5
@@ -7,9 +7,10 @@ using UnityEngine;
|
|||||||
/// projected above the head via Camera.main each LateUpdate - NOT world-space, so names always draw over the
|
/// 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
|
/// 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
|
/// 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
|
/// [minFontSize, maxFontSize]. Visibility: a label shows only while its avatar's body is rendered locally
|
||||||
/// proxy for "not first-person" (the FP controller self-hides the mesh, including while Esc-paused).
|
/// (own first-person self-hide, the per-client hide-phase matrix, found hiders, paint-reveal gate - a name
|
||||||
/// Per-role/phase visibility (hide phase etc.) is deliberately not applied yet.
|
/// 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>
|
/// </summary>
|
||||||
[DisallowMultipleComponent]
|
[DisallowMultipleComponent]
|
||||||
public class PlayerNameplates : MonoBehaviour
|
public class PlayerNameplates : MonoBehaviour
|
||||||
@@ -63,6 +64,12 @@ public class PlayerNameplates : MonoBehaviour
|
|||||||
}
|
}
|
||||||
|
|
||||||
var cam = Camera.main;
|
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++)
|
for (int i = 0; i < _entries.Count; i++)
|
||||||
{
|
{
|
||||||
Entry e = _entries[i];
|
Entry e = _entries[i];
|
||||||
@@ -70,8 +77,12 @@ public class PlayerNameplates : MonoBehaviour
|
|||||||
|
|
||||||
bool show = cam;
|
bool show = cam;
|
||||||
|
|
||||||
// Own avatar: label only while the body is rendered locally (hidden = first person / load freeze).
|
// Label only while the body is rendered locally: covers the own first-person self-hide AND every
|
||||||
if (show && e.setup.IsOwner && (!e.body || !e.body.enabled))
|
// 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;
|
show = false;
|
||||||
|
|
||||||
Vector3 screen = default;
|
Vector3 screen = default;
|
||||||
|
|||||||
Reference in new issue
Block a user