示例#1
0
 public GameServices(
     IGameRepository gameRepository,
     IQuestionRepository questionRepository,
     IRollDice dice)
 {
     this.gameRepository     = gameRepository;
     this.questionRepository = questionRepository;
     this.dice = dice;
 }
示例#2
0
        internal GameQuestion Move(IRollDice dice, int playerId)
        {
            CheckPlayable();
            CheckPlayerTurn(playerId);
            CurrentPlayer.CheckCanMove();

            var          diceRoll      = dice.Roll();
            GameQuestion questionToAsk = null;

            if (CurrentPlayer.CannotGoOutOfPenaltyBox(diceRoll))
            {
                NextPlayerTurn();
            }
            else
            {
                questionToAsk = CurrentPlayer.Move(diceRoll, Categories);
            }
            return(questionToAsk);
        }
示例#3
0
        public IEnumerable <IDomainEvent> Move(IRollDice dice, string playerId)
        {
            CheckPlayable();
            CheckPlayerTurn(playerId);
            _currentPlayer.CheckCanMove();

            var diceRoll = dice.Roll();

            if (_currentPlayer.CannotGoOutOfPenaltyBox(diceRoll))
            {
                yield return(NextPlayerTurn());
            }
            else
            {
                foreach (var @event in _currentPlayer.Move(diceRoll, _questionsDeck)) // Meh!! Missing yield! return from F# :/
                {
                    yield return(@event);
                }
            }
        }
示例#4
0
 public DiceController(IRollDice diceRoller)
 {
     this.diceRoller = diceRoller;
 }