コード例 #1
0
 private void OnServerAddPlayerInternal(NetworkConnection conn)
 {
     if (playerPrefab == null)
     {
         if (!LogFilter.Debug)
         {
             return;
         }
         Logger.LogError("The PlayerPrefab is empty on the NetworkManager. Please setup a PlayerPrefab object.", Category.Connections);
     }
     else if (playerPrefab.GetComponent <NetworkIdentity>() == null)
     {
         if (!LogFilter.Debug)
         {
             return;
         }
         Logger.LogError("The PlayerPrefab does not have a NetworkIdentity. Please add a NetworkIdentity to the player prefab.", Category.Connections);
     }
     // else if (playerControllerId < conn.playerControllers.Count && conn.playerControllers[playerControllerId].IsValid &&
     //  conn.playerControllers[playerControllerId].gameObject != null)
     // {
     //  if (!LogFilter.Debug)  FIXME!! - need a way to determine if player has already spawned before this round
     //  {
     //      return;
     //  }
     //  Logger.LogError("There is already a player at that playerControllerId for this connections.", Category.Connections);
     // }
     else
     {
         PlayerSpawn.ServerSpawnViewer(conn);
     }
 }