Exemple #1
0
 /// <summary>
 /// Server only. Fetches are players from ServerManager players map
 /// </summary>
 public void GetAllPlayersData()
 {
     foreach (Player player in GameManager.GetPlayers())
     {
         if (!player.isAI)
         {
             ServerPlayer sp = ServerManager.Singleton.GetPlayer(player.SteamID);
             StartCoroutine(BackendManager.FetchCharacterFromServer(player.SteamID, sp.cid, (cData, status) => {
                 if (status == BackendManager.STATUS_OK)
                 {
                     player.CData = cData;
                     CharacterFetched?.Invoke(player.SteamID, cData);
                 }
                 Debug.LogError(status);
             }));
         }
         else
         {
             // Not implemented in backend yet.
             StartCoroutine(BackendManager.FetchAIFromServer(player.aiPlayerID, (cData, status) => {
                 if (status == BackendManager.STATUS_OK)
                 {
                     player.CData = cData;
                     CharacterFetched?.Invoke(player.SteamID, cData);
                 }
                 Debug.LogError(status);
             }));
         }
     }
 }