示例#1
0
 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.");
     }
 }
示例#2
0
 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.");
     }
 }