}//end throwButton

        private void timer1_Tick(object sender, EventArgs e)
        {
            Two_Up_Game.IncrementCounter();
            bool heads   = true;
            bool tails   = false;
            int  counter = Two_Up_Game.GetCounter();

            if ((counter == 1) || (counter == 3) || (counter == 5) || (counter == 7) || (counter == 9))
            {
                UpdatePictureBoxImage(pictureBox1, heads);
                UpdatePictureBoxImage(pictureBox2, heads);
            }
            else if ((counter == 2) || (counter == 4) || (counter == 6) || (counter == 8))
            {
                UpdatePictureBoxImage(pictureBox1, tails);
                UpdatePictureBoxImage(pictureBox2, tails);
            }
            else
            {
                timer1.Stop();
                Two_Up_Game.TossCoins();                                         //tosses the coins
                UpdateImage();                                                   //updates the images with correct images
                label1.Text        = Two_Up_Game.TossOutcome();                  //updates label1 with the outcome of the toss
                label1.Visible     = true;                                       //makes label1 visible
                label3.Text        = Two_Up_Game.GetPlayersScore().ToString();   //updates player's score when outcome is heads
                label5.Text        = Two_Up_Game.GetComputersScore().ToString(); //updates computer's score when outcome is tails
                playButton.Visible = true;                                       //makes 'play' button visible
            }
        }
Пример #2
0
        // a timer click will be implemented, where during the throw button, the coin will
        // siphon through either heads or tails until after a certain time, it will then land and choose
        // either heads or tails

        private void timer1_Tick(object sender, EventArgs e)
        {
            counter += 1;
            Two_Up_Game.TossCoin();
            UpdatePictureBoxImage(pictureBox1, Two_Up_Game.IsHeads(0));
            UpdatePictureBoxImage(pictureBox2, Two_Up_Game.IsHeads(1));
            label5.Visible      = true;
            label5.Text         = Two_Up_Game.TossOutcome();
            throwButton.Enabled = false;
            if (counter == 10)
            {
                timer1.Stop();
                if (Two_Up_Game.TossOutcome() == "Odd")
                {
                    throwButton.Enabled = true;
                }
                playernumberLabel.Text   = Convert.ToString(Two_Up_Game.GetPlayersScore());
                computernumberLabel.Text = Convert.ToString(Two_Up_Game.GetComputersScore());
            }
        }
Пример #3
0
 /// <summary>
 /// Updates Scores
 /// </summary>
 private void UpdateScores()
 {
     playerScore.Text   = Two_Up_Game.GetPlayersScore().ToString();
     computerScore.Text = Two_Up_Game.GetComputersScore().ToString();
 }