示例#1
0
 public void TestFreezeDie()
 {
     Die die = new Die();
     Assert.IsFalse(die.IsFrozen);
     die.Freeze();
     Assert.IsTrue(die.IsFrozen);
 }
示例#2
0
        public DieSet()
        {
            TimesRolled = 0;

            if (Die1 == null)
            {
                Die1 = new Die();
                //Die1.SetRandom(random);
                //System.Threading.Thread.Sleep(100);
                Die2 = new Die();
                //Die2.SetRandom(random);
                //System.Threading.Thread.Sleep(100);
                Die3 = new Die();
                //Die3.SetRandom(random);
                //System.Threading.Thread.Sleep(100);
                Die4 = new Die();
                //Die4.SetRandom(random);
                //System.Threading.Thread.Sleep(100);
                Die5 = new Die();
                //Die5.SetRandom(random);

                Dice.Add(Die1);
                Dice.Add(Die2);
                Dice.Add(Die3);
                Dice.Add(Die4);
                Dice.Add(Die5);
            }
        }
示例#3
0
        public void TestRollDie()
        {
            Random random = new Random();
            Die die1 = new Die();
            die1.Roll(random);

            Assert.IsTrue(die1.Value > 0);
        }
示例#4
0
        public DieSet(int[] count)
        {
            Die die;

            for (int i = 1; i <= 6; i++)
            {
                for (int j = 1; j <= count[i]; j++)
                {
                    die = new Die(i);
                    Dice.Add(die);
                }
            }
        }
示例#5
0
        public DieSet(int d1, int d2, int d3, int d4, int d5)
        {
            Die1 = new Die(d1);
            Die2 = new Die(d2);
            Die3 = new Die(d3);
            Die4 = new Die(d4);
            Die5 = new Die(d5);

            Dice.Add(Die1);
            Dice.Add(Die2);
            Dice.Add(Die3);
            Dice.Add(Die4);
            Dice.Add(Die5);
        }
示例#6
0
 public void TestSetRandom()
 {
     Die die = new Die();
     die.SetRandom(new Random());
 }
示例#7
0
        private void RenderDie(Die die, PictureBox diePicBox)
        {
            if (die.Value == 1)
            {
                diePicBox.Image = die1;
            }
            if (die.Value == 2)
            {
                diePicBox.Image = die2;
            }
            if (die.Value == 3)
            {
                diePicBox.Image = die3;
            }
            if (die.Value == 4)
            {
                diePicBox.Image = die4;
            }
            if (die.Value == 5)
            {
                diePicBox.Image = die5;
            }
            if (die.Value == 6)
            {
                diePicBox.Image = die6;
            }

            if (die.IsFrozen)
            {
                diePicBox.BorderStyle = BorderStyle.FixedSingle;
                diePicBox.BackColor = Color.Black;
            }
            else
            {
                diePicBox.BorderStyle = BorderStyle.Fixed3D;
                diePicBox.BackColor = Color.White;
            }
        }