Exemplo n.º 1
0
        public int GetDiceRoll()
        {
            int total;

            Dice1.Roll();
            Dice2.Roll();
            total = Dice1.FaceValue + Dice2.FaceValue;

            if (doubleRule == true)
            {
                if (Dice1.FaceValue == Dice2.FaceValue)
                {
                    Dice3.Roll();
                    total = total + Dice3.FaceValue;
                }
            }

            return(total);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Roll the dices and return their values.
        /// </summary>
        /// <param name="dice1">First dice. If true, the dice value will be processed again.</param>
        /// <param name="dice2">Second dice. If true, the dice value will be processed again.</param>
        /// <param name="dice3">Third dice. If true, the dice value will be processed again.</param>
        public void RollDices()
        {
            if (!this.Dice1.Checked)
            {
                Dice1.Roll();
            }
            if (!this.Dice2.Checked)
            {
                Dice2.Roll();
            }
            if (!this.Dice3.Checked)
            {
                Dice3.Roll();
            }

            // Sorts the score so it's shown from the bigger number to the lowest.
            char[] arrayTmp = (Dice1.ToString() + Dice2.ToString() + Dice3.ToString()).ToArray();
            Array.Sort(arrayTmp);
            Array.Reverse(arrayTmp);
            GamePlayers.CurrentPlayer.DiceRoll = Convert.ToInt32(new string(arrayTmp));

            GamePlayers.CurrentPlayer.PlaysLeft--;
        }