Exemplo n.º 1
0
        /// <summary>
        /// Player commands will passed on to the round processor.  Each player can only send one command per turn.
        /// Once the command for all of the players have been recieved, the round will be processed.
        /// </summary>
        /// <param name="player">The issuing player</param>
        /// <param name="command">The command to performa</param>
        void player_CommandListener(Player player, ICommand command)
        {
            _roundProcessor.AddPlayerCommand(player, command);

            if (_players.Count(x => !x.PlayerEntity.Killed) == 0)
            {
                //No more players remaing in game
                return;
            }

            if (_roundProcessor.CountCommandsRecieved() == _players.Count(x => !x.PlayerEntity.Killed)) //All players sent their commands, process the round
            {
                ProcessRound();
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Player commands will passed on to the round processor.  Each player can only send one command per turn.
        /// Once the command for all of the players have been recieved, the round will be processed.
        /// </summary>
        /// <param name="player">The issuing player</param>
        /// <param name="command">The command to performa</param>
        void player_CommandListener(Player player, ICommand command)
        {
            _roundProcessor.AddPlayerCommand(player, command);

            if (_players.Count(x => !x.BattleshipPlayer.Killed) == 0)
            {
                _resetEvent.Set();
                return;
            }

            if (_roundProcessor.CountCommandsRecieved() == _players.Count(x => !x.BattleshipPlayer.Killed))
            {
                //All players sent their commands, process the round
                _resetEvent.Set();
            }
        }