Esempio n. 1
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--;
        }