Пример #1
0
 public bool AddPlayer(int playerIndex)
 {
     for (int i = 0; i < AllowedPlayersIDs.Count; i++)
     {
         if (AllowedPlayersIDs[i] == playerIndex)
         {
             return(false);
         }
     }
     AllowedPlayersIDs.Add(playerIndex);
     return(true);
 }
Пример #2
0
        public bool RemovePlayer(int playerIndex)
        {
            bool result = false;

            for (int i = 0; i < AllowedPlayersIDs.Count; i++)
            {
                if (AllowedPlayersIDs[i] == playerIndex)
                {
                    AllowedPlayersIDs.RemoveAt(i);
                    i--;
                    result = true;
                }
            }
            return(result);
        }