Example #1
0
        /// <summary>
        /// Rolls a dice
        /// </summary>
        /// <returns></returns>
        public IDiceRollResult Roll()
        {
            var result = DiceRoller.RollDice(CubeSides);

            if (!IsLoseNumber(result.Score, MaxLooseNumber))
            {
                TurnScoreControl.AddTurnPoints(result.Score);
                TurnControl.CurrentPlayer.Score += result.Score;
            }
            else
            {
                TurnControl.CurrentPlayer.Score -= TurnScoreControl.CurrentTurnPoints;
                TurnScoreControl.ClearTurnPoints();
                TurnControl.Next();
            }

            if (Player1.Score >= WinPointQuantity)
            {
                Win(Player1);
            }
            else if (Player2.Score >= WinPointQuantity)
            {
                Win(Player2);
            }
            return(result);
        }
Example #2
0
 /// <summary>
 /// Ends the players turn.
 /// </summary>
 public void EndTurn()
 {
     if (TurnScoreControl.CurrentTurnPoints != 0)
     {
         TurnScoreControl.ClearTurnPoints();
         TurnControl.Next();
     }
 }