コード例 #1
0
 //======================================================
 // Game Initialization
 //======================================================
 void OnServerInitialized()
 {
     // Debug.Log("Server initialized");
     // Debug.Log("Expected player count : " + _numberOfPlayers);
     // Notify any delegates that we are connected to the game
     SetClientPlayerNumber(_numberOfPlayers);
     if (!_isDedicateServer)
     {
         // Here we add host as a new player
         allLobbyPlayers.Add(Network.player);
     }
     // Send the number of players for this session and add it but RPC buffer
     _networkInterface.CallSetClientPlayerNumber(_numberOfPlayers);
     if (!_isDedicateServer && _numberOfPlayers == 1)
     {
         StartSession();
     }
 }