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:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user