示例#1
0
        private void resetGame()
        {
            totalScore        = 0;
            totalDispatches   = 0;
            averageDispatches = 0;
            gameLost          = false;

            PrimaryTimer.Stop();

            for (int x = 0; x < gameBoardHeight; x++)
            {
                for (int y = 0; y < gameBoardWidth; y++)
                {
                    btn[x, y].BackgroundImage = BoxGame.Properties.Resources.emptyslot;
                    btn[x, y].Tag             = "empty";
                }
            }

            // When the form has loaded we mark out the parts of the grid for the belt
            for (int x = 0; x < gameBoardWidth; x++)
            {
                for (int y = 0; y < 2; y++)
                {
                    btn[x, y].BackgroundImage = BoxGame.Properties.Resources.beltarea;
                }
            }
            tickCounter = 0;
            PrimaryTimer.Start();
        }
示例#2
0
 // Cant rename this
 private void button1_Click_1(object sender, EventArgs e)
 {
     Console.WriteLine("The game is " + gameLost);
     if (paused && gameLost == false)
     {
         paused = false;
         pauseButton.BackgroundImage = BoxGame.Properties.Resources.pausebutton;
         PrimaryTimer.Start();
     }
     else if (!paused && gameLost == false)
     {
         paused = true;
         pauseButton.BackgroundImage = BoxGame.Properties.Resources.unpausebutton;
         PrimaryTimer.Stop();
     }
 }
示例#3
0
        private void SpawnBox()
        {
            string spawnBoxType = (string)btn[userX, 2].Tag;

            Console.WriteLine("The Current Box Type Below Is - " + spawnBoxType);

            if (spawnBoxType == "prime" || spawnBoxType == "ups" || spawnBoxType == "fedex")
            {
                PrimaryTimer.Stop();
                gameLost         = true;
                FiredPnl.Visible = true;
            }

            // Box Type 1 - Spawn Prime Box
            if (nextBoxType == 1)
            {
                // Spawn a new box (Change the image of an existing button)
                btn[userX, 2].BackgroundImage = BoxGame.Properties.Resources.primebox;
                btn[userX, 2].Tag             = "prime";
                currentBoxType = 1;
            }

            // Box Type 2 - Spawn UPS Box
            if (nextBoxType == 2)
            {
                // Spawn a new box (Change the image of an existing button)
                btn[userX, 2].BackgroundImage = BoxGame.Properties.Resources.upsbox;
                btn[userX, 2].Tag             = "ups";
                currentBoxType = 2;
            }

            // Box Type 3 - Spawn fedEx Box
            if (nextBoxType == 3)
            {
                // Spawn a new box (Change the image of an existing button)
                btn[userX, 2].BackgroundImage = BoxGame.Properties.Resources.fedexbox;
                btn[userX, 2].Tag             = "fedex";
                currentBoxType = 3;
            }

            // Set the last xPos to be the new spawn value
            currentXPos = (userX);
            currentYPos = 2;
        }
示例#4
0
 private void BackBtn2_Click(object sender, EventArgs e)
 {
     MainMenuPanel.Visible = true;
     PrimaryTimer.Stop();
     FiredPnl.Visible = false;
 }
示例#5
0
 private void QuitJobBtn_Click(object sender, EventArgs e)
 {
     MainMenuPanel.Visible = true;
     PrimaryTimer.Stop();
 }