void RemovePlayer(Player player) { _allPlayers.Remove(player); _localId2Player.Remove(player.localId); if (_localId2Player.Count == 0) { Console.WriteLine("All players left, stopping current simulation..."); IsRunning = false; State = ERoomState.Idle; _lobby.RemoveRoom(this); } else { Console.WriteLine(CurPlayerCount + " players remaining."); } }
public void OnPlayerLeave(Player player) { Debug.Log($"Player{player.PlayerId} Leave room {RoomId}"); _allPlayers.Remove(player); _localId2Player.Remove(player.localId); netId2LocalId.Remove(player.netID); if (netId2LocalId.Count == 0) { Console.WriteLine("All players left, stopping current simulation..."); IsRunning = false; State = ERoomState.Idle; _lobby.RemoveRoom(this); } else { Console.WriteLine(CurPlayerCount + " players remaining."); } }