Add lobby/match-start matchmaking flow with additive scene management

Replace the connection-approval role selection with a server-authoritative
match flow built on NGO additive scene management:

- Scenes: Main is the persistent foundation (NetworkManager, GameModeManager,
  cameras, HUD); Lobby and Test Map load/unload additively. Add Lobby + Test Map
  to the build settings; remove the obsolete SampleScene.
- MatchManager (plain MonoBehaviour singleton): loads Lobby on server start,
  StartMatchTrigger lets the host start the match, rolls one random Hunter (rest
  Hider), swaps Lobby -> Test Map (strictly serialized per NGO), respawns each
  player as its role variant. Forces additive client sync mode so clients keep
  Main instead of single-loading it (fixes "Destination scene is not valid").
- Server-driven spawning: null out NetworkConfig.PlayerPrefab at runtime to
  disable auto-spawn, then spawn players after the lobby floor exists (fixes
  falling through the floor) with double-spawn and transition guards.
- StartMatchTrigger: server-gated OnTriggerEnter, only the host's own player
  starts the match.
- NetworkBootstrap: drop role selection / connection approval; everyone spawns
  as the neutral Player prefab. Host/Client/Server/Shutdown buttons stay.
- NetworkPlayerSetup.ScopedModes flag (baked on Hunter/Hider prefabs): lobby
  avatar gets the full mode set, match variants get the role-scoped set.
- GameModeManager.BindLocalPlayer reads ScopedModes and rebinds the painter
  unconditionally (fixes stale painter binding on respawn -> brush painting in
  every mode).
- MeshPainter.PaintingEnabled defaults to false (unbound/pre-spawn/remote never
  paints); PaintHud visibility now also gates on a bound painter (fixes the HUD
  showing at startup before any avatar exists).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
adminandClaude Opus 4.8 committed 2026-06-27 22:44:18 +02:00
1 parent 301f7e64cb
commit bd70f3b8b9
18 files changed
+1813 -997

No files matched your search

+9
View File
@@ -26,9 +26,18 @@ public class NetworkPlayerSetup : NetworkBehaviour
"Hunter on the Hunter prefab); GameModeManager reads it on spawn to build this role's mode set.")]
[SerializeField] private PlayerRole role = PlayerRole.Hider;
[Tooltip("False = lobby/neutral avatar (the base Player prefab) gets the FULL mode set; true = match " +
"avatar (Hunter/Hider variant) gets only its role's modes. Baked per prefab variant, so the " +
"mode set follows the spawned avatar with no replicated-phase timing race.")]
[SerializeField] private bool scopedModes = false;
/// <summary>The side this avatar plays (Hunter/Hider), baked into the prefab variant.</summary>
public PlayerRole Role => role;
/// <summary>True on the match role variants (scope the mode set to <see cref="Role"/>); false on the
/// neutral lobby Player prefab (full mode set). Baked per prefab variant.</summary>
public bool ScopedModes => scopedModes;
public override void OnNetworkSpawn()
{
var controller = GetComponent<PlayerCharacterController>();