예제 #1
0
        public void AddPlayer(Player player)
        {
            lock (gameAccess)
            {
                if (TooManyPlayers())
                {
                    throw new MapIsFullException("Map is full. Try next match.");
                }
                if (ActiveMatch)
                {
                    throw new MatchAlreadyStartedException("There is a match going on. Wait for next match.");
                }
                if (Map.IsPlayerInMap(player))
                {
                    throw new PlayerAlreadyInMatch("This player has already been taken, select other player");
                }

                player.EnabledAttackAction = false;
                player.Join(this);
            }
        }