Example #1
0
        //gameover sequence and destructor
        public void GameOver()
        {
            //stop timer
            gravity.Stop();
            gravity.Enabled = false;

            //reinitialize score
            score = 0;

            //remove all buttons
            for (int ix = Controls.Count - 1; ix >= 0; ix--)
            {
                if (Controls[ix] is Button && Controls[ix] != start && Controls[ix] != loadSongs)
                {
                    Controls[ix].Dispose();
                }
            }

            //get system and then release it to be able to load a new song
            FMOD.System sys = new FMOD.System();
            sys = detector.getSystem();
            sys.release();
            sys.close();

            //messagebox showing high score
            MessageBox.Show("Game Over" + "\nHigh Score: " + Convert.ToString(high), "Euphoria", MessageBoxButtons.OK, MessageBoxIcon.Information);

            //show hidden UI
            start.Visible      = true;
            songs.Visible      = true;
            loadSongs.Visible  = true;
            difficulty.Visible = true;

            //hide in-game UI
            highScore.Visible    = false;
            scoreDisplay.Visible = false;
            np.Visible           = false;

            //remove hitfield
            Controls.Remove(pic);
            Controls.Remove(hitBar);
        }