Add Hunter/Hider role selection on connect with role-scoped modes

Roles are chosen in the bootstrap dev panel before Host/Client. NGO
ConnectionApproval is enabled at runtime and maps the role payload to
the matching prefab variant per connection (Hunter/Hider), so each peer
spawns the correct avatar including the host.

- PlayerRole.cs (new): single source of truth enum { Hider, Hunter }.
- NetworkBootstrap.cs: role toggle, ConnectionApproval + role payload,
  server ApprovalCheck mapping role -> PrefabIdHash.
- NetworkPlayerSetup.cs: serialized PlayerRole field + Role property.
- GameModeManager.cs: BuildModes(role) - Hunter -> [First Person, Paint],
  Hider -> [Third Person, Paint, Free Cam]; binds role from spawned avatar.
- Hunter.prefab: role = Hunter override.
- SampleScene.unity: NetworkBootstrap prefab references wired.

Also includes user inspector scale tuning (Hunter 2.5->2.4, Hider 0.5->0.7).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
adminandClaude Opus 4.8 committed 2026-06-27 17:01:43 +02:00
1 parent dec537a60f
commit 56caa0edd8
8 files changed
+138 -47

No files matched your search

+8
View File
@@ -21,6 +21,14 @@ public class NetworkPlayerSetup : NetworkBehaviour
[Tooltip("Slots per ring before the radius steps outward, so spacing stays roughly constant as more join.")]
[SerializeField] private int spawnRingSlots = 8;
[Header("Role")]
[Tooltip("Which side this avatar plays. Baked per prefab variant (Hider on the base/Hider prefab, " +
"Hunter on the Hunter prefab); GameModeManager reads it on spawn to build this role's mode set.")]
[SerializeField] private PlayerRole role = PlayerRole.Hider;
/// <summary>The side this avatar plays (Hunter/Hider), baked into the prefab variant.</summary>
public PlayerRole Role => role;
public override void OnNetworkSpawn()
{
var controller = GetComponent<PlayerCharacterController>();