Supprime les mini-jeux (survival/teams), corrige tous les bugs identifiés

- Supprime DeathZone.cs, ZoneCapture.cs, ArenaZoneBuilder.cs
- ArenaRoom.js : mode race uniquement, fix _checkRoundEndCondition, fix _getActiveCount
- GameState.js : supprime team (Player) et deathZoneY/teamScoreRed/teamScoreBlue (GameState)
- NetworkSchema.cs : aligne sur le nouveau schéma serveur (supprime team, indices corrigés)
- NetworkManager.cs : supprime OnDeathZoneYChanged/SendDeathZoneHit/SendInZone, OnRoundStart passe totalRounds
- GameManager.cs : subscriptions OnEnable→Start/OnDestroy, fix Lobby (player visible si connecté), HandleRoundStart(totalRounds)
- GameHUD.cs : supprime blocs survival/teams, ajoute SetTotalRounds, supprime dead code
- PlayerController.cs : cache Rigidbody, fix OnCollisionStay gel (supprime else), SetSpawnPosition
- CheckpointSystem.cs : flash le prochain checkpoint actif, supprime FinishFlash vide
- LobbyUI.cs : CancelInvoke sur connexion, appelle SetSpawnPosition

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-17 16:28:37 +02:00
parent 456d876847
commit 4743c307a6
15 changed files with 120 additions and 1195 deletions

View File

@@ -88,6 +88,7 @@ public class LobbyUI : MonoBehaviour
_lobbyActive = false;
_isConnecting = false;
_statusMessage = "";
CancelInvoke(nameof(CheckConnectionTimeout));
// --- Activate the player hierarchy ---
if (playerRoot != null)
@@ -113,6 +114,7 @@ public class LobbyUI : MonoBehaviour
rb.position = spawnPos;
}
pc.transform.position = spawnPos;
pc.SetSpawnPosition(spawnPos);
Debug.Log($"[Lobby] Player teleported to spawn: {spawnPos}");
}
pc.enabled = true;

View File

@@ -44,10 +44,9 @@ public class NetworkManager : MonoBehaviour
public event Action<float> OnCountdownChanged; // seconds remaining
public event Action<string, string> OnEliminated; // sessionId, reason
public event Action<string> OnQualified; // sessionId
public event Action<int, string> OnRoundStart; // roundNumber, mode
public event Action<int, string, int> OnRoundStart; // roundNumber, mode, totalRounds
public event Action<int> OnRoundEnd; // roundNumber
public event Action<string> OnGameEnd; // winnerName
public event Action<float> OnDeathZoneYChanged; // for survival mode
// --- Internals ---
private Client _client;
@@ -145,7 +144,6 @@ public class NetworkManager : MonoBehaviour
// Game state changes
_callbacks.Listen(state => state.phase, (newValue, prevValue) => _OnPhaseChanged(newValue));
_callbacks.Listen(state => state.countdown, (newValue, prevValue) => OnCountdownChanged?.Invoke(newValue));
_callbacks.Listen(state => state.deathZoneY, (newValue, prevValue) => OnDeathZoneYChanged?.Invoke(newValue));
// Server messages
_room.OnMessage<EliminatedMsg>("eliminated", msg =>
@@ -161,7 +159,7 @@ public class NetworkManager : MonoBehaviour
_room.OnMessage<RoundStartMsg>("roundStart", msg =>
{
Debug.Log($"[Network] Round {msg.round} started ({msg.mode})");
OnRoundStart?.Invoke(msg.round, msg.mode);
OnRoundStart?.Invoke(msg.round, msg.mode, msg.totalRounds);
});
_room.OnMessage<RoundEndMsg>("roundEnd", msg =>
{
@@ -208,18 +206,6 @@ public class NetworkManager : MonoBehaviour
await _room.Send("checkpointReached", new { index });
}
public async void SendDeathZoneHit()
{
if (_room != null && IsConnected)
await _room.Send("deathZoneHit", null);
}
public async void SendInZone(bool inZone)
{
if (_room != null && IsConnected)
await _room.Send("inZone", new { inZone });
}
// ─── State Callbacks ─────────────────────────────────────────────────
private void _OnPhaseChanged(string phase)
@@ -285,11 +271,6 @@ public class NetworkManager : MonoBehaviour
new Vector3(player.avx, player.avy, player.avz)
);
// Sync team color changes (for teams mode)
controller.UpdateTeamColor(player.team,
new Color(player.colorR, player.colorG, player.colorB));
// Hide/show eliminated remote players
controller.SetVisible(!player.isEliminated);
}
}

View File

@@ -25,8 +25,7 @@ public partial class NetworkPlayer : Schema
[Type(18, "boolean")] public bool isEliminated = false;
[Type(19, "boolean")] public bool isQualified = false;
[Type(20, "boolean")] public bool isReady = false;
[Type(21, "int8")] public int team = 0;
[Type(22, "int8")] public int checkpointIndex = 0;
[Type(21, "int8")] public int checkpointIndex = 0;
}
public partial class NetworkState : Schema
@@ -40,8 +39,5 @@ public partial class NetworkState : Schema
[Type(4, "int8")] public int totalRounds = 4;
[Type(5, "int8")] public int playersAlive = 0;
[Type(6, "string")] public string gameMode = "race";
[Type(7, "float32")] public float deathZoneY = -100;
[Type(8, "int16")] public int teamScoreRed = 0;
[Type(9, "int16")] public int teamScoreBlue = 0;
[Type(10, "string")] public string winnerName = "";
[Type(7, "string")] public string winnerName = "";
}