Exemplo n.º 1
0
        public GamePanel()
        {
            InitializeComponent();
            guys[0] = new Guy()
            {
                Money = 50, Name = "Joe", MyLabel = lblJoe, MyRadioButton = radioJoe
            };
            guys[1] = new Guy()
            {
                Money = 50, Name = "Bob", MyLabel = lblBob, MyRadioButton = radioBob
            };
            guys[2] = new Guy()
            {
                Money = 50, Name = "Al", MyLabel = lblAl, MyRadioButton = radioAl
            };
            foreach (Guy guy in guys)
            {
                guy.PlaceBet(0, 0);
            }

            //set the default bet name to Joe
            lblName.Text = guys[0].Name;

            obj[0] = new GreyHound()
            {
                MyPictureBox     = pictureBox1,
                StartingPosition = pictureBox1.Left,
                trackLength      = racetrackPictureBox.Width - pictureBox1.Width,
                Randomizer       = new Random()
            };

            obj[1] = new GreyHound()
            {
                MyPictureBox     = pictureBox2,
                StartingPosition = pictureBox2.Left,
                trackLength      = racetrackPictureBox.Width - pictureBox2.Width,
                Randomizer       = obj[0].Randomizer
            };

            obj[2] = new GreyHound()
            {
                MyPictureBox     = pictureBox3,
                StartingPosition = pictureBox3.Left,
                trackLength      = racetrackPictureBox.Width - pictureBox3.Width,
                Randomizer       = obj[0].Randomizer
            };

            obj[3] = new GreyHound()
            {
                MyPictureBox     = pictureBox4,
                StartingPosition = pictureBox4.Left,
                trackLength      = racetrackPictureBox.Width - pictureBox4.Width,
                Randomizer       = obj[0].Randomizer
            };

            updateForm();
        }
Exemplo n.º 2
0
        public GamePanel()
        {
            InitializeComponent();
            guys[0] = new Guy()
            {
                Money = 75, Name = "Shivam", MyLabel = lblJoe, MyRadioButton = radioJoe
            };
            guys[1] = new Guy()
            {
                Money = 75, Name = "Rishi", MyLabel = lblBob, MyRadioButton = radioBob
            };
            guys[2] = new Guy()
            {
                Money = 75, Name = "Smith", MyLabel = lblAl, MyRadioButton = radioAl
            };
            foreach (Guy guy in guys)
            {
                guy.PlaceBet(0, 0);
            }

            //set the default bet name to Joe
            lblName.Text = guys[0].Name;

            GreyhoundArray[0] = new GreyHound()
            {
                MyPictureBox     = pictureBox1,
                StartingPosition = pictureBox1.Left,
                RacetrackLength  = racetrackPictureBox.Width - pictureBox1.Width,
                Randomizer       = new Random()
            };

            GreyhoundArray[1] = new GreyHound()
            {
                MyPictureBox     = pictureBox2,
                StartingPosition = pictureBox2.Left,
                RacetrackLength  = racetrackPictureBox.Width - pictureBox2.Width,
                Randomizer       = GreyhoundArray[0].Randomizer
            };

            GreyhoundArray[2] = new GreyHound()
            {
                MyPictureBox     = pictureBox3,
                StartingPosition = pictureBox3.Left,
                RacetrackLength  = racetrackPictureBox.Width - pictureBox3.Width,
                Randomizer       = GreyhoundArray[0].Randomizer
            };

            GreyhoundArray[3] = new GreyHound()
            {
                MyPictureBox     = pictureBox4,
                StartingPosition = pictureBox4.Left,
                RacetrackLength  = racetrackPictureBox.Width - pictureBox4.Width,
                Randomizer       = GreyhoundArray[0].Randomizer
            };

            GreyhoundArray[4] = new GreyHound()
            {
                MyPictureBox     = pictureBox5,
                StartingPosition = pictureBox5.Left,
                RacetrackLength  = racetrackPictureBox.Width - pictureBox4.Width,
                Randomizer       = GreyhoundArray[0].Randomizer
            };

            updateForm();
        }