Ejemplo n.º 1
0
        public Form1()
        {
            InitializeComponent();

            MyRandomizer   = new Random();
            GreyhoundArray = new Greyhound[4];
            GuyArray       = new Guy[3];



            GreyhoundArray[0] = new Greyhound()
            {
                MyPictureBox     = pictureBox_Dog1,
                StartingPosition = pictureBox_Dog1.Left,
                RacetrackLength  = pictureBox_RaceTrack.Width - pictureBox_Dog1.Width,
                Location         = 0,
                Randomizer       = MyRandomizer
            };

            GreyhoundArray[1] = new Greyhound()
            {
                MyPictureBox     = pictureBox_Dog2,
                StartingPosition = pictureBox_Dog2.Left,
                RacetrackLength  = pictureBox_RaceTrack.Width - pictureBox_Dog2.Width,
                Location         = 1,
                Randomizer       = MyRandomizer
            };
            GreyhoundArray[2] = new Greyhound()
            {
                MyPictureBox     = pictureBox_Dog3,
                StartingPosition = pictureBox_Dog3.Left,
                RacetrackLength  = pictureBox_RaceTrack.Width - pictureBox_Dog3.Width,
                Location         = 2,
                Randomizer       = MyRandomizer
            };

            GreyhoundArray[3] = new Greyhound()
            {
                MyPictureBox     = pictureBox_Dog4,
                StartingPosition = pictureBox_Dog4.Left,
                RacetrackLength  = pictureBox_RaceTrack.Width - pictureBox_Dog4.Width,
                Location         = 3,
                Randomizer       = MyRandomizer
            };


            GuyArray = new Guy[3];

            GuyArray[0] = new Guy()
            {
                Name          = "Joe",
                MyRadioButton = radioButton_Joe,
                MyLabel       = label_JoeLog,
                Cash          = 50
            };

            GuyArray[1] = new Guy()
            {
                Name          = "Bob",
                MyRadioButton = radioButton_Bob,
                MyLabel       = label_BobLog,
                Cash          = 190
            };

            GuyArray[2] = new Guy()
            {
                Name          = "Al",
                MyRadioButton = radioButton_Al,
                MyLabel       = label_AlLog,
                Cash          = 200
            };

            CurrentGuy = GuyArray[0];

            GuyArray[0].MyRadioButton.Text = GuyArray[0].Name + " has " + GuyArray[0].Cash + "$";
            GuyArray[1].MyRadioButton.Text = GuyArray[1].Name + " has " + GuyArray[1].Cash + "$";
            GuyArray[2].MyRadioButton.Text = GuyArray[2].Name + " has " + GuyArray[2].Cash + "$";
        }