Ejemplo n.º 1
0
        /// <summary>
        /// Method with actions that are to be performed on crossing the finish line
        /// </summary>
        public void Finish()
        {
            int check = 0;

            //Checked all waypoints past
            foreach (int i in Checkpoints)
            {
                if (i == 1)
                {
                    check++;
                }
            }

            //If all waypoints passed add a round
            if (check == 5)
            {
                for (int i = 0; i < 5; i++)
                {
                    Checkpoints[i] = 0;
                }

                roundsElapsed++;
            }

            //Open winner window when rounds is 3
            if (roundsElapsed == MainWindow.requiredRounds)
            {
                MainWindow.ActiveForm.Hide();
                FinishWindow Finish = new FinishWindow(playerName);
                Finish.Closed += (s, args) => MainWindow.ActiveForm.Close();
                Finish.Show();
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Method with actions that are to be performed on crossing the finish line
        /// </summary>
        public void Finish()
        {
            int check = 0;

            //Checked all waypoints past
            foreach (int i in Checkpoints)
            {
                if (i == 1)
                {
                    check++;
                }
            }

            //If all waypoints passed add a round
            if (check == 5)
            {
                for (int i = 0; i < 5; i++)
                {
                    Checkpoints[i] = 0;
                }

                roundsElapsed++;
            }

            //Open winner window when rounds is 3
            if (roundsElapsed == MainWindow.requiredRounds)
            {
                MainWindow.ActiveForm.Hide();
                FinishWindow Finish = new FinishWindow(playerName);
                Finish.Closed += (s, args) => MainWindow.ActiveForm.Close();
                Finish.Show();
            }
        }