Example #1
0
 void SetPlayerNumbers()
 {
     string[] forcedPlayers = ForcePlayers.Split(',');
     if (forcedPlayers.Length <= 1)
     {
         List <string> playersList = GamePlayers.Keys.ToList();
         foreach (int akt in Enumerable.Range(1, playersList.Count))
         {
             int playerIdx;
             do
             {
                 playerIdx = R.Next(playersList.Count);
             } while (GamePlayers[playersList[playerIdx]].PlayerNumber > 0);
             GamePlayers[playersList[playerIdx]].PlayerNumber = akt;
         }
     }
     else
     {
         for (int i = 0; i < forcedPlayers.Length; i++)
         {
             if (GamePlayers.ContainsKey(forcedPlayers[i]))
             {
                 GamePlayers[forcedPlayers[i]].PlayerNumber = i + 1;
             }
         }
     }
     foreach (Player aktPlayer in GamePlayers.Values)
     {
         TakePlanets(aktPlayer);
     }
 }