示例#1
0
 // TODO : Need to handle the connected player after game started
 void OnPlayerConnected(NetworkPlayer player)
 {
     // Here we add a new player
     // Debug.Log("New player connected : " + player.ToString());
     allLobbyPlayers.Add(player);
     // Once all expected players have joined, send all clients the list of players
     if (allLobbyPlayers.Count == _numberOfPlayers)
     {
         foreach (NetworkPlayer p in allLobbyPlayers)
         {
             // Debug.Log("Calling RegisterPlayerAll...");
             _networkInterface.CallRegisterPlayerAll(p);
         }
         // start the game
         // Debug.Log("Ready to Start Sesion : " + allLobbyPlayers.Count + "/" + _numberOfPlayers);
         _networkInterface.CallStartSession();
     }
 }