Пример #1
0
 // Copy the Current Settings to the Current Profiles Settings
 private void CopyCurrentSettingsToCurrentProfilesSettings()
 {
     // Update the Current Profiles Settings
     CProfiles.Instance().mcCurrentProfile.iLowerPitch = CSoundInput.Instance().iLowerPitchRange;
     CProfiles.Instance().mcCurrentProfile.iUpperPitch = CSoundInput.Instance().iUpperPitchRange;
     CProfiles.Instance().mcCurrentProfile.sName = CSoundInput.Instance().sProfileName;
 }
Пример #2
0
        // Function to update the combo-box list of Profiles
        private void UpdateShownProfilesAndCurrentSettings()
        {
            // Clear the combo box of all entries
            comboProfiles.Items.Clear();

            // Loop through each of the Profiles
            CProfiles.Instance().mcProfileList.ForEach(delegate(CProfile sProfile)
            {
                // Add this Profiles Name to the combo box
                comboProfiles.Items.Add(sProfile.sName);
            });

            // Get the Name of the Profile which should be Selected
            string sName = CProfiles.Instance().mcCurrentProfile.sName;

            // Make sure the Current Profile is selected
            // If we couldn't find the Current Profile in the combo box
            if (comboProfiles.Items.IndexOf(sName) < 0)
            {
                MessageBox.Show("Could not find current profile in comboProfiles", "Error finding profile in combo box");
            }
            // Else we found which Profile Name should be selected
            else
            {
                // Select the Current Profiles Name
                comboProfiles.SelectedItem = sName;
            }

            // Use the Current Profiles Settings
            CProfiles.Instance().CopyCurrentProfileSettingsToCurrentSoundInputSettings();
        }
Пример #3
0
        // If the Delete Profile button was pressed
        private void buttonDeleteProfile_Click(object sender, EventArgs e)
        {
            // Delete the current Profile
            CProfiles.Instance().DeleteCurrentProfileFromTheProfileList();

            // Update comboProfiles to show the new Profile List
            UpdateShownProfilesAndCurrentSettings();
        }
Пример #4
0
        // If the Profile to use was changed
        private void comboProfiles_SelectedIndexChanged(object sender, EventArgs e)
        {
            // Get the new Current Profile to use
            CProfiles.Instance().mcCurrentProfile = CProfiles.Instance().mcProfileList[CProfiles.Instance().mcProfileList.IndexOf(new CProfile((string)comboProfiles.SelectedItem))];

            // Copy this Profiles Settings to the Current Settings
            CProfiles.Instance().CopyCurrentProfileSettingsToCurrentSoundInputSettings();
        }
Пример #5
0
        // When the Player presses the Close button
        private void buttonClose_Click(object sender, EventArgs e)
        {
            // Copy the Current Settings to this Profiles Settings
            CopyCurrentSettingsToCurrentProfilesSettings();

            // Save the Profiles to File
            CProfiles.Instance().SaveProfilesToFile();

            // Reset the Game type to the Main Menu
            mcGameHandle.meGame = EGames.MainMenu;

            // Close this form
            this.Close();
        }
Пример #6
0
        // Return the singleton Instance of this class
        public static CProfiles Instance()
        {
            // Lock the Instance so only one thread can use it at a time
            lock (Lock)
            {
                // If this class Instance hasn't been created yet
                if (mcInstance == null)
                {
                    // Create the Instance
                    mcInstance = new CProfiles();
                }

                return(mcInstance);
            }
        }
Пример #7
0
        // If the Profiles combo box has lost focus, check to see if the Profile Name was changed
        private void comboProfiles_Leave(object sender, EventArgs e)
        {
            // Get the New Profile Name
            string sNewName = (string)comboProfiles.Text;
            string sOldName = CProfiles.Instance().mcCurrentProfile.sName;

            // If a valid name was entered and the Name of the Profile was changed
            if (sNewName != null && !sNewName.Equals("") && !sNewName.Equals(sOldName))
            {
                // Give this Profile it's new Name
                CProfiles.Instance().mcCurrentProfile.sName = sNewName;
            }

            // Update comboProfiles to show the new Profile
            UpdateShownProfilesAndCurrentSettings();
        }
Пример #8
0
        // If the create a New Profile button was pressed
        private void buttonNewProfile_Click(object sender, EventArgs e)
        {
            string sName            = "";
            bool   bUniqueNameFound = false;
            int    iNameNumber      = 0;

            // Save changes to the Current Profile before creating a new one
            CopyCurrentSettingsToCurrentProfilesSettings();

            // Create a temporary Profile
            CProfile cProfile = new CProfile();

            // Find a name not already taken for this Profile
            while (!bUniqueNameFound)
            {
                // Assume that the Name we look for will be unique
                bUniqueNameFound = true;

                // Create the name to check for
                sName = "Profile" + ++iNameNumber;

                // Loop through each of the Profiles in the List
                CProfiles.Instance().mcProfileList.ForEach(delegate(CProfile sProfileToCheck)
                {
                    // If this Profile already has the Name
                    if (sProfileToCheck.sName.Equals(sName))
                    {
                        // Mark that the Name is not unique
                        bUniqueNameFound = false;
                    }
                });
            }

            // Set initial values
            cProfile.sName       = sName;
            cProfile.iLowerPitch = 45;
            cProfile.iUpperPitch = 70;

            // Add this Profile to the List
            CProfiles.Instance().AddProfileToListAndSetItAsTheCurrentProfile(cProfile);

            // Update comboProfiles to show the new Profile
            UpdateShownProfilesAndCurrentSettings();
        }
Пример #9
0
        // Class constructor
        public formMain()
        {
            // Initialize all form controls
            InitializeComponent();

            // Create the initial Game object (default is the Main Menu)
            mcGame = new CMainMenu();

            // Offscreen devices to draw to (double buffering)
            // NOTE: Can only draw to 790x560 area though because the windows title bar and
            //       side bars are included in the 800x600 area
            mcBackBufferImage = new Bitmap(800, 600);   // Create a 800x600 pixel area to draw to
            mcBackBuffer      = Graphics.FromImage(mcBackBufferImage);

            // Enable double-buffering to help avoid flicker
            SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            SetStyle(ControlStyles.DoubleBuffer, true);

            // Start the Update Stopwatch
            mcUpdateStopwatch = new Stopwatch();
            mcUpdateStopwatch.Reset();
            mcUpdateStopwatch.Start();

            // Setup FPS variables
            miFPSFrames = 0;
            miFPSTime   = 0;
            miFPS       = 0;
            mbShowFPS   = true;
            mcFontFPS   = new Font("Arial", 10, FontStyle.Regular);

            // Load the Profiles from the File, and use the last Selected one
            CProfiles.Instance().LoadProfilesFromFile();

            // Initialize the Transition structure
            msTransition.Reset();
        }
Пример #10
0
        // Update the Main Menu display
        public override void Update(float fTimeSinceLastUpdateInSeconds, Graphics cBackBuffer)
        {
            // Brush and Pen to draw with
            Brush cBrush;
            Pen   cPen;

            // Reset the Game Icon position and sizes
            mrPongIcon            = new Rectangle(25, 250, 128, 128);
            mrShootingGalleryIcon = new Rectangle(150, 400, 128, 128);
            mrPitchMatcherIcon    = new Rectangle(275, 250, 128, 128);
            mrTargetPracticeIcon  = new Rectangle(400, 400, 128, 128);
            mrProfileSettingsIcon = new Rectangle(525, 250, 128, 128);
            mrHighScoresIcon      = new Rectangle(650, 400, 128, 128);

            // If the Selected Game icon should grow
            if (mbSelectedGameScaleGrow)
            {
                // Grow at a rate of 20% per second
                mfSelectedGameScale += (0.2f * fTimeSinceLastUpdateInSeconds);

                // If the Image has grown all the way
                if (mfSelectedGameScale >= 0.1f)
                {
                    mfSelectedGameScale     = 0.1f;
                    mbSelectedGameScaleGrow = false;
                }
            }
            // Else it should shrink
            else
            {
                // Shrink at a rate of 20% per second
                mfSelectedGameScale -= (0.2f * fTimeSinceLastUpdateInSeconds);

                // If the Image has been shrunk all the way
                if (mfSelectedGameScale <= -0.1f)
                {
                    mfSelectedGameScale     = -0.1f;
                    mbSelectedGameScaleGrow = true;
                }
            }

            // Grow/Shrink the Selected Game icon
            switch (meSelectedGame)
            {
            default:
            case EGames.Spong:
                mrPongIcon.Inflate((int)(mfSelectedGameScale * mrPongIcon.Width), (int)(mfSelectedGameScale * mrPongIcon.Height));
                break;

            case EGames.ShootingGallery:
                mrShootingGalleryIcon.Inflate((int)(mfSelectedGameScale * mrShootingGalleryIcon.Width), (int)(mfSelectedGameScale * mrShootingGalleryIcon.Height));
                break;

            case EGames.PitchMatcher:
                mrPitchMatcherIcon.Inflate((int)(mfSelectedGameScale * mrPitchMatcherIcon.Width), (int)(mfSelectedGameScale * mrPitchMatcherIcon.Height));
                break;

            case EGames.TargetPractice:
                mrTargetPracticeIcon.Inflate((int)(mfSelectedGameScale * mrTargetPracticeIcon.Width), (int)(mfSelectedGameScale * mrTargetPracticeIcon.Height));
                break;

            case EGames.ProfileSettings:
                mrProfileSettingsIcon.Inflate((int)(mfSelectedGameScale * mrProfileSettingsIcon.Width), (int)(mfSelectedGameScale * mrProfileSettingsIcon.Height));
                break;

            case EGames.HighScores:
                mrHighScoresIcon.Inflate((int)(mfSelectedGameScale * mrHighScoresIcon.Width), (int)(mfSelectedGameScale * mrHighScoresIcon.Height));
                break;
            }

            // Clear the Drawing Surface
            cBackBuffer.Clear(Color.Black);

            // Draw the Main Menu background
            cBackBuffer.DrawImage(mcBackgroundImage, 0, 0, 800, 600);

            // Draw Pong game icon
            cBackBuffer.DrawImage(mcPongImage, mrPongIcon);

            // Draw Shooting Gallery game icon
            cBackBuffer.DrawImage(mcShootingGalleryImage, mrShootingGalleryIcon);

            // Draw Pitch Matcher game icon
            cBackBuffer.DrawImage(mcPitchMatcherImage, mrPitchMatcherIcon);

            // Draw Target Practice game icon
            cBackBuffer.DrawImage(mcTargetPracticeImage, mrTargetPracticeIcon);

            // Draw the Profile Settings icon
            cBackBuffer.DrawImage(mcProfileSettingsImage, mrProfileSettingsIcon);

            // Draw the High Scores icon
            cBackBuffer.DrawImage(mcHighScoresImage, mrHighScoresIcon);

            // Display which Profile is currently being used
            cBrush = new SolidBrush(Color.WhiteSmoke);
            string sWelcome = "Profile: " + CProfiles.Instance().mcCurrentProfile.sName;

            cBackBuffer.DrawString(sWelcome, mcFontText, cBrush, 5, 3);

            // Display the Toggle Sound option
            cPen = new Pen(Color.WhiteSmoke);
            string sPlaySounds = "Play Sounds ";

            if (CFMOD.mbSoundOn)
            {
                sPlaySounds += " X";
            }
            cBackBuffer.DrawString(sPlaySounds, mcFontText, cBrush, 650, 540);
            cBackBuffer.DrawRectangle(cPen, 765, 540, 20, 20);

            // Release the Brush and Pen resources
            cBrush.Dispose();
            cPen.Dispose();
        }
Пример #11
0
        // Updated the Ball and Paddle
        private void UpdateGameObjects(float fTimeSinceLastUpdateInSeconds, Graphics cBackBuffer)
        {
            // Subtract the Time Passed from the Time to Wait before changing Target Pitches
            mfTimeBeforeChangingTargetPitchInSeconds -= fTimeSinceLastUpdateInSeconds;

            // Move the Target Pitch by it's Velocity
            float fOldUnitTargetPitch = mfCurrentUnitTargetPitch;

            mfCurrentUnitTargetPitch += mfTargetPitchChangeVelocity * fTimeSinceLastUpdateInSeconds;

            // If the moving Target Pitch passed it's desired Pitch
            if (mfTargetPitchChangeVelocity != 0.0f &&
                ((fOldUnitTargetPitch <= mfUnitTargetPitchToAchieve && mfCurrentUnitTargetPitch >= mfUnitTargetPitchToAchieve) ||
                 (fOldUnitTargetPitch >= mfUnitTargetPitchToAchieve && mfCurrentUnitTargetPitch <= mfUnitTargetPitchToAchieve)))
            {
                // Set the Current Target Pitch to the Pitch To Achieve
                mfCurrentUnitTargetPitch = mfUnitTargetPitchToAchieve;

                // Randomly specify how long we should wait at this Target Pitch for
                mfTimeBeforeChangingTargetPitchInSeconds = ((float)mcRandom.NextDouble() * mfMAX_TARGET_PITCH_WAIT_TIME);

                // Set the Target Pitch Velocity to zero
                mfTargetPitchChangeVelocity = 0.0f;
            }

            // If the Pitch To Match should change, AND it's not changing already
            if (mfTimeBeforeChangingTargetPitchInSeconds <= 0.0f && mfTargetPitchChangeVelocity == 0.0f)
            {
                // Specify the new Target Pitch to achieve
                mfUnitTargetPitchToAchieve = (float)mcRandom.NextDouble();

                // Specify the new Target Pitch Velocity
                mfTargetPitchChangeVelocity = (float)(mcRandom.Next(1, 10) * 0.1f);

                // If the Velocity should be negative
                if (mfUnitTargetPitchToAchieve < mfCurrentUnitTargetPitch)
                {
                    mfTargetPitchChangeVelocity *= -1.0f;
                }
            }

            // Update the Pitch Meter to Match
            mcPitchMeterToMatch.UpdatePitchIndicatorsPosition(mfCurrentUnitTargetPitch);

            // Update the Players Pitch Meter
            mcPitchMeter.AutoDetectPitchAndUpdateMeter();


            // Get how far away from the Target Pitch the Player is
            float fPitchDifference = Math.Abs(mcPitchMeter.mfPitchIndicatorUnitPosition - mfCurrentUnitTargetPitch);

            // If the Player is close enough to the Target Pitch
            if (fPitchDifference <= mfMAX_UNIT_PITCH_DIFFERENCE_TO_EARN_POINTS)
            {
                // Give the Player points based on how close they are to the Target Pitch
                miScore += (int)(Math.Abs(fPitchDifference - mfMAX_UNIT_PITCH_DIFFERENCE_TO_EARN_POINTS) * 1000);
            }


            // Subtract the Time passed from the Remaining Game Time
            mfGameTimeRemaining -= fTimeSinceLastUpdateInSeconds;

            // If the Game should be over
            if (mfGameTimeRemaining < 0.0f)
            {
                // If the Player beat their old High Score
                if (miScore > CProfiles.Instance().mcCurrentProfile.iScorePitchMatcher)
                {
                    // Update and save the Players new High Score
                    CProfiles.Instance().mcCurrentProfile.iScorePitchMatcher = miScore;
                    CProfiles.Instance().SaveProfilesToFile();
                }

                // Restart the Game
                Reset();
            }
        }
Пример #12
0
        string msTargetPracticeHighScoreName;       // The Profile Name of the Highest Score holder


        // Class constructor
        public CHighScores()
        {
            try
            {
                // Pre-load images


                // Pre-load sounds
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString(), "Exception caught");
            }

            // Setup the Fonts
            mcFontTitle = new Font("Arial", 30, FontStyle.Regular);
            mcFontText  = new Font("Arial", 20, FontStyle.Regular);

            // Record that we are playing Pong
            meGame = EGames.HighScores;

            // Initialize all of the High Scores
            miSpongHighScore = miPitchMatcherHighScore = miTargetPracticeHighScore = 0;
            miShootingGallerySong1HighScore = miShootingGallerySong2HighScore = miShootingGallerySong3HighScore = 0;

            // Find and store the global High Scores
            CProfiles.Instance().mcProfileList.ForEach(delegate(CProfile cProfile)
            {
                // If this Profiles Spong Score is better than the current High Score
                if (cProfile.iScoreSpong >= miSpongHighScore)
                {
                    // Save this Profile as the High Score holder for now
                    miSpongHighScore     = cProfile.iScoreSpong;
                    msSpongHighScoreName = cProfile.sName;
                }

                // If this Profiles Shooting Gallery Song 1 Score is better than the current High Score
                if (cProfile.iScoreShootingGallerySong1 >= miShootingGallerySong1HighScore)
                {
                    // Save this Profile as the High Score holder for now
                    miShootingGallerySong1HighScore     = cProfile.iScoreShootingGallerySong1;
                    msShootingGallerySong1HighScoreName = cProfile.sName;
                }

                // If this Profiles Shooting Gallery Song 2 Score is better than the current High Score
                if (cProfile.iScoreShootingGallerySong2 >= miShootingGallerySong2HighScore)
                {
                    // Save this Profile as the High Score holder for now
                    miShootingGallerySong2HighScore     = cProfile.iScoreShootingGallerySong2;
                    msShootingGallerySong2HighScoreName = cProfile.sName;
                }

                // If this Profiles Shooting Gallery Song 2 Score is better than the current High Score
                if (cProfile.iScoreShootingGallerySong2 >= miShootingGallerySong1HighScore)
                {
                    // Save this Profile as the High Score holder for now
                    miShootingGallerySong2HighScore     = cProfile.iScoreShootingGallerySong2;
                    msShootingGallerySong3HighScoreName = cProfile.sName;
                }

                // If this Profiles Pitch Matcher Score is better than the current High Score
                if (cProfile.iScorePitchMatcher >= miPitchMatcherHighScore)
                {
                    // Save this Profile as the High Score holder for now
                    miPitchMatcherHighScore     = cProfile.iScorePitchMatcher;
                    msPitchMatcherHighScoreName = cProfile.sName;
                }

                // If this Profiles Target Practice Score is better than the current High Score
                if (cProfile.iScoreTargetPractice >= miTargetPracticeHighScore)
                {
                    // Save this Profile as the High Score holder for now
                    miTargetPracticeHighScore     = cProfile.iScoreTargetPractice;
                    msTargetPracticeHighScoreName = cProfile.sName;
                }
            });
        }
Пример #13
0
        // Do game processing and update the display
        public override void Update(float fTimeSinceLastUpdateInSeconds, Graphics cBackBuffer)
        {
            Brush cBrush;           // Used to draw text
            Brush cGameNameBrush;   // Used to draw the Name of the Games text

            // Save a handle to the Current Profile for readability
            CProfile cProfile = CProfiles.Instance().mcCurrentProfile;

            // Clear the scene
            cBackBuffer.Clear(Color.Black);

            // Display the High Scores title and the Players High Scores title
            cBrush = new SolidBrush(Color.RoyalBlue);
            cBackBuffer.DrawString("High Scores", mcFontTitle, cBrush, 250, 50);
            cBackBuffer.DrawString("      Your\nHigh Scores", mcFontTitle, cBrush, 550, 10);

            // Change the Brush Color
            cBrush         = new SolidBrush(Color.LightBlue);
            cGameNameBrush = new SolidBrush(Color.LightGreen);

            // Display the Spong Scores
            cBackBuffer.DrawString("Spong", mcFontText, cGameNameBrush, 10, 110);
            cBackBuffer.DrawString(msSpongHighScoreName, mcFontText, cBrush, 250, 110);
            cBackBuffer.DrawString(miSpongHighScore.ToString(), mcFontText, cBrush, 325, 140);
            cBackBuffer.DrawString(cProfile.iScoreSpong.ToString(), mcFontText, cBrush, 625, 140);

            // Display the Shooting Gallery Song 1 Scores
            cBackBuffer.DrawString("Shooting Gallery", mcFontText, cGameNameBrush, 10, 180);
            cBackBuffer.DrawString("Song 1", mcFontText, cGameNameBrush, 50, 230);
            cBackBuffer.DrawString(msShootingGallerySong1HighScoreName, mcFontText, cBrush, 250, 230);
            cBackBuffer.DrawString(miShootingGallerySong1HighScore.ToString(), mcFontText, cBrush, 325, 260);
            cBackBuffer.DrawString(cProfile.iScoreShootingGallerySong1.ToString(), mcFontText, cBrush, 625, 260);

            // Display the Shooting Gallery Song 2 Scores
            cBackBuffer.DrawString("Song 2", mcFontText, cGameNameBrush, 50, 290);
            cBackBuffer.DrawString(msShootingGallerySong2HighScoreName, mcFontText, cBrush, 250, 290);
            cBackBuffer.DrawString(miShootingGallerySong2HighScore.ToString(), mcFontText, cBrush, 325, 320);
            cBackBuffer.DrawString(cProfile.iScoreShootingGallerySong2.ToString(), mcFontText, cBrush, 625, 320);

            // Display the Shooting Gallery Song 3 Scores
            cBackBuffer.DrawString("Song 3", mcFontText, cGameNameBrush, 50, 350);
            cBackBuffer.DrawString(msShootingGallerySong3HighScoreName, mcFontText, cBrush, 250, 350);
            cBackBuffer.DrawString(miShootingGallerySong3HighScore.ToString(), mcFontText, cBrush, 325, 380);
            cBackBuffer.DrawString(cProfile.iScoreShootingGallerySong3.ToString(), mcFontText, cBrush, 625, 380);

            // Display the Pitch Matcher Scores
            cBackBuffer.DrawString("Pitch Matcher", mcFontText, cGameNameBrush, 10, 420);
            cBackBuffer.DrawString(msPitchMatcherHighScoreName, mcFontText, cBrush, 250, 420);
            cBackBuffer.DrawString(miPitchMatcherHighScore.ToString(), mcFontText, cBrush, 325, 450);
            cBackBuffer.DrawString(cProfile.iScorePitchMatcher.ToString(), mcFontText, cBrush, 625, 450);

            // Display the Target Practice Scores
            cBackBuffer.DrawString("Target Practice", mcFontText, cGameNameBrush, 10, 490);
            cBackBuffer.DrawString(msTargetPracticeHighScoreName, mcFontText, cBrush, 250, 490);
            cBackBuffer.DrawString(miTargetPracticeHighScore.ToString(), mcFontText, cBrush, 325, 520);
            cBackBuffer.DrawString(cProfile.iScoreTargetPractice.ToString(), mcFontText, cBrush, 625, 520);

            // Release the Brush resources
            cBrush.Dispose();
            cGameNameBrush.Dispose();
        }
Пример #14
0
        // Clears the scene and draws the game (Paddle, Ball, Walls, Text)
        private void DrawGame(float fTimeSinceLastUpdateInSeconds, Graphics cBackBuffer)
        {
            Brush cBrush;   // Used to draw solid shapes
            Pen   cPen;     // Used to draw outlines of shapes

            // Clear the scene
            cBackBuffer.Clear(Color.Black);

            // Draw the Target
            cBackBuffer.DrawImage(mcTargetImage, mrTarget);


            // Find the Middle Point of the Bow And Arrow to Rotate around
            PointF sMiddlePoint = new Point();

            sMiddlePoint.X = mrBOW_AND_ARROW_POSITION.X + (mrBOW_AND_ARROW_POSITION.Width / 2.0f);
            sMiddlePoint.Y = mrBOW_AND_ARROW_POSITION.Y + (mrBOW_AND_ARROW_POSITION.Height / 2.0f);

            // Rotate the Bow And Arrow by the specified Bow And Arrow Rotation Amount
            System.Drawing.Drawing2D.Matrix sRotationMatrix = new System.Drawing.Drawing2D.Matrix(1, 0, 0, 1, 0, 0);
            sRotationMatrix.RotateAt(miBowAndArrowRotation, sMiddlePoint);
            cBackBuffer.Transform = sRotationMatrix;

            // Draw the Bow And Arrow with the Rotation applied
            cBackBuffer.DrawImageUnscaled(mcBowAndArrowImage, mrBOW_AND_ARROW_POSITION);


            // If the Arrow has been fired
            if (meTargetPracticeState == ETargetPracticeGameStates.FiredArrow)
            {
                // Find the Middle Point of the Arrow to Rotate around
                sMiddlePoint.X = mrArrow.X + (mrArrow.Width / 2.0f);
                sMiddlePoint.Y = mrArrow.Y + (mrArrow.Height / 2.0f);

                // Rotate theArrow by the specified Arrow Rotation Amount
                sRotationMatrix = new System.Drawing.Drawing2D.Matrix(1, 0, 0, 1, 0, 0);
                sRotationMatrix.RotateAt(miArrowRotation, sMiddlePoint);
                cBackBuffer.Transform = sRotationMatrix;

                // Draw the Bow And Arrow with the Rotation applied
                cBackBuffer.DrawImageUnscaled(mcArrowImage, (int)mrArrow.X, (int)mrArrow.Y);
            }

            // Reset the World Transformation Matrix to get rid of Rotation
            cBackBuffer.Transform = new System.Drawing.Drawing2D.Matrix();

            // Draw the Power Meter
            Rectangle rPowerMeterFill = new Rectangle(mrBOW_AND_ARROW_POSITION.X + 1, mrBOW_AND_ARROW_POSITION.Y + mrBOW_AND_ARROW_POSITION.Height + 31, 199, 24);

            cPen   = new Pen(Color.LightBlue);
            cBrush = new LinearGradientBrush(rPowerMeterFill, Color.Yellow, Color.Red, LinearGradientMode.Horizontal);

            // Draw Power Meter outline
            cBackBuffer.DrawRectangle(cPen, rPowerMeterFill.X - 1, rPowerMeterFill.Y - 1, rPowerMeterFill.Width + 1, rPowerMeterFill.Height + 1);

            // Draw the Power Meter Gradient
            cBackBuffer.FillRectangle(cBrush, rPowerMeterFill);

            // Cover up some of the Power Meter Gradient to show the Power being used
            cBrush = new SolidBrush(Color.Black);
            int       iBlackFillWidth      = (int)(rPowerMeterFill.Width * (1.0f - mfUnitBowAndArrowPower));
            Rectangle rPowerMeterBlackFill = new Rectangle(rPowerMeterFill.X + (rPowerMeterFill.Width - iBlackFillWidth), rPowerMeterFill.Y, iBlackFillWidth, 24);

            // If the Black Fill has a Width
            if (rPowerMeterBlackFill.Width > 0)
            {
                // Draw the Black Fill overtop of the gradient
                cBackBuffer.FillRectangle(cBrush, rPowerMeterBlackFill);
            }


            // Display to press Space Bar to Pause the game
            cBrush = new SolidBrush(Color.LightBlue);
            cBackBuffer.DrawString("Shoot - Space Bar / Left Mouse", mcFontText, cBrush, 75, 530);

            // Display th press N for a New Target
            cBackBuffer.DrawString("New Target - N", mcFontText, cBrush, 550, 530);

            // Display the players Score
            cBackBuffer.DrawString("Targets Hit In A Row " + miScore, mcFontText, cBrush, 10, 10);

            // Display the players current High Score
            cBackBuffer.DrawString("Your High Score " + CProfiles.Instance().mcCurrentProfile.iScoreTargetPractice.ToString(), mcFontText, cBrush, 500, 10);

            // If the Arrow is "dead"
            if (mfResetArrowWaitTime > 0.0f)
            {
                string sResultText = "";

                // If it Hit the Target
                if (mbArrowHitTarget)
                {
                    sResultText = "HIT";
                }
                // Else it missed the Target
                else
                {
                    sResultText = "MISS";
                }

                // Display if the Player hit the Target or not
                cBackBuffer.DrawString(sResultText, mcFontLarge, cBrush, 300, 200);
            }

            // Release the Brush resource
            cBrush.Dispose();
        }
Пример #15
0
        // Update the Bow And Arrow and the Arrow
        private void UpdateGameObjects(float fTimeSinceLastUpdateInSeconds, Graphics cBackBuffer)
        {
            // If the Player is Aiming
            if (meTargetPracticeState == ETargetPracticeGameStates.Aiming)
            {
                // Use the Players current Pitch as the Bow And Arrow Rotation Amount
                mcPitchMeter.AutoDetectPitchAndUpdateMeter();
                miBowAndArrowRotation = (int)(mcPitchMeter.mfPitchIndicatorUnitPosition * -45.0f);

                // Save the amount of Power being used
                mfUnitBowAndArrowPower = ((CSoundInput.Instance().fAmplitude - 90.0f) / 20.0f);

                // Make sure the Power is in a valid range of Zero to One
                if (mfUnitBowAndArrowPower < 0.0f)
                {
                    mfUnitBowAndArrowPower = 0.0f;
                }
                else if (mfUnitBowAndArrowPower > 1.0f)
                {
                    mfUnitBowAndArrowPower = 1.0f;
                }
            }
            // Else the Arrow has been fired
            else
            {
                // If the Arrow is not "dead" yet
                if (mfResetArrowWaitTime <= 0.0f)
                {
                    // Update the Arrows Velocity by Gravity
                    mcArrowVelocity += (mcGRAVITY_ACCELERATION * fTimeSinceLastUpdateInSeconds);

                    // Calculate the Arrows new Position
                    mrArrow.X += (mcArrowVelocity.X * fTimeSinceLastUpdateInSeconds);
                    mrArrow.Y += (mcArrowVelocity.Y * fTimeSinceLastUpdateInSeconds);

                    // Get the Rotation angle of the Arrow so that it faces the direction it is travelling
                    float fArrowRotationInRadians = 0.0f;
                    bool  bChangeRotation         = true;
                    if (mcArrowVelocity.Y < 0.0f)
                    {
                        fArrowRotationInRadians = (float)(Math.PI + Math.Atan(mcArrowVelocity.X / mcArrowVelocity.Y));
                    }
                    else if (mcArrowVelocity.Y > 0.0f)
                    {
                        fArrowRotationInRadians = (float)(Math.Atan(mcArrowVelocity.X / mcArrowVelocity.Y));
                    }
                    // Else the Arrow has no Y Velocity
                    else
                    {
                        if (mcArrowVelocity.X > 0.0f)
                        {
                            fArrowRotationInRadians = (float)(Math.PI / 2.0f);
                        }
                        else if (mcArrowVelocity.X < 0.0f)
                        {
                            fArrowRotationInRadians = (float)((3.0f * Math.PI) / 2.0f);
                        }
                        // Else the Arrow has no X Velocity
                        else
                        {
                            // Rotation is undefined, so leave rotationa as is
                            bChangeRotation = false;
                        }
                    }

                    // If the Rotation should be updated
                    if (bChangeRotation)
                    {
                        // Convert the Radians to Degrees and store the result
                        miArrowRotation = 90 - (int)(fArrowRotationInRadians * (180.0f / Math.PI));
                    }
                }

                // If the Arrow should be reset
                if (mrArrow.IntersectsWith(mrTarget) || mrArrow.X > 800 || mrArrow.Y > 485)
                {
                    // If the Arrow just "died"
                    if (mfResetArrowWaitTime == 0.0f)
                    {
                        // If the Arrow hit the Target
                        if (mrArrow.IntersectsWith(mrTarget))
                        {
                            // Record it as a hit
                            mbArrowHitTarget = true;

                            // Update the Players Score
                            miScore++;

                            // If the Players Score is more than their current High Score
                            if (miScore > CProfiles.Instance().mcCurrentProfile.iScoreTargetPractice)
                            {
                                // Update the Players High Score and Save
                                CProfiles.Instance().mcCurrentProfile.iScoreTargetPractice = miScore;
                                CProfiles.Instance().SaveProfilesToFile();
                            }

                            // Play the Hit sound
                            CFMOD.PlaySound(msSoundHit, false);
                        }
                        // Else if the Arrow did not hit anything
                        else if (mrArrow.X > 800 || mrArrow.Y > 485)
                        {
                            // Record that it was not a hit
                            mbArrowHitTarget = false;

                            // Reset the Players Score
                            miScore = 0;

                            // Play the Miss sound
                            CFMOD.PlaySound(msSoundMiss, false);
                        }

                        // Reset the Arrows Velocity to zero
                        mcArrowVelocity *= 0.0f;
                    }

                    // Update how long we have waited for
                    mfResetArrowWaitTime += fTimeSinceLastUpdateInSeconds;

                    // If we have waited long enough since the Arrow "died"
                    if (mfResetArrowWaitTime > 1.0f)
                    {
                        // Reset the Arrows Position
                        MoveArrowToBow();

                        // If the Arrow hit the Target
                        if (mbArrowHitTarget)
                        {
                            // Create a new Target to hit
                            MoveTargetToNewRandomLocation();
                        }

                        // Reset the Arrow Wait Time
                        mfResetArrowWaitTime = 0.0f;

                        // Change the Game State to Aiming
                        meTargetPracticeState = ETargetPracticeGameStates.Aiming;
                    }
                }
            }
        }
Пример #16
0
        // Update the Ball and Paddle
        private void UpdateGameObjects(float fTimeSinceLastUpdateInSeconds, Graphics cBackBuffer)
        {
            // Temp local variables
            int       iBallXDistanceTravelled = 0;      // How far the Ball has moved in the X direction
            int       iBallYDistanceTravelled = 0;      // How far the Ball has moved in the Y direction
            Rectangle rBallOldPosition        = mrBall; // Rectangle used to test Ball against collisions
            Rectangle rBallCollisionRect;               // Rectangle used to test Ball against collisions

            // Move the Pitch Meter according to any Input Pitch
            mcPitchMeter.AutoDetectPitchAndUpdateMeter();

            // If some Pitch Input was received
            if (CSoundInput.Instance().bInputReceived)
            {
                // Calculate what Percent of force should be used to move the Paddle
                float fPercentToMove = mcPitchMeter.mfPitchIndicatorUnitPosition - 0.5f;
                fPercentToMove *= 2.0f;

                // Calculate how many pixels to move the Paddle
                float fAmountToMove = fPercentToMove * (-miPADDLE_MAX_SPEED_PER_SECOND * fTimeSinceLastUpdateInSeconds);

                // Move the Paddle
                mrPaddle.Y += (int)fAmountToMove;
            }

            // Calculate how far the Ball should move
            iBallXDistanceTravelled = (int)(mcBallDirection.X * fTimeSinceLastUpdateInSeconds);
            iBallYDistanceTravelled = (int)(mcBallDirection.Y * fTimeSinceLastUpdateInSeconds);

            // Move the Ball
            mrBall.X += iBallXDistanceTravelled;
            mrBall.Y += iBallYDistanceTravelled;

            // Test for collision between the Ball and the Walls

            // Rectangle to use to test collisions against the Ball
            rBallCollisionRect = mrBall;

            // If the Ball has travelled further than it's width or height in the last frame
            if (Math.Abs(iBallXDistanceTravelled) >= mrBall.Width ||
                Math.Abs(iBallYDistanceTravelled) >= mrBall.Height)
            {
                // If the Ball is moving right
                if (iBallXDistanceTravelled > 0)
                {
                    // If the Ball is moving down
                    if (iBallYDistanceTravelled > 0)
                    {
                        rBallCollisionRect.Location = rBallOldPosition.Location;
                        rBallCollisionRect.Width    = mrBall.Right - rBallOldPosition.Left;
                        rBallCollisionRect.Height   = mrBall.Bottom - rBallOldPosition.Top;
                    }
                    // Else the Ball is moving up
                    else
                    {
                        rBallCollisionRect.X      = rBallOldPosition.X;
                        rBallCollisionRect.Y      = mrBall.Top;
                        rBallCollisionRect.Width  = mrBall.Right - rBallOldPosition.Left;
                        rBallCollisionRect.Height = rBallOldPosition.Bottom - mrBall.Top;
                    }
                }
                // Else the Ball is moving left
                else
                {
                    // If the Ball is moving down
                    if (iBallYDistanceTravelled > 0)
                    {
                        rBallCollisionRect.X      = mrBall.Left;
                        rBallCollisionRect.Y      = rBallOldPosition.Top;
                        rBallCollisionRect.Width  = rBallOldPosition.Right - mrBall.Left;
                        rBallCollisionRect.Height = mrBall.Bottom - rBallOldPosition.Top;
                    }
                    // Else the Ball is moving up
                    else
                    {
                        rBallCollisionRect.Location = mrBall.Location;
                        rBallCollisionRect.Width    = rBallOldPosition.Right - mrBall.Left;
                        rBallCollisionRect.Height   = rBallOldPosition.Bottom - mrBall.Top;
                    }
                }
            }

            // If the Ball hit the Top Wall
            if (rBallCollisionRect.IntersectsWith(mrTopWall))
            {
                // Reverse it's Y direction
                mcBallDirection.Y = -mcBallDirection.Y;

                // Place it to be hitting the Wall (not in the Wall)
                mrBall.Y = mrTopWall.Bottom;

                // Play Sound
                CFMOD.PlaySound(msSoundBallBounce, false);
            }
            // If the Ball hit the Bottom Wall
            else if (rBallCollisionRect.IntersectsWith(mrBottomWall))
            {
                // Reverse it's Y direction
                mcBallDirection.Y = -mcBallDirection.Y;

                // Place it to be hitting the Wall (not in the Wall)
                mrBall.Y = mrBottomWall.Top - mrBall.Height;

                // Play Sound
                CFMOD.PlaySound(msSoundBallBounce, false);
            }

            // If the Ball hit the Right wall
            if (rBallCollisionRect.IntersectsWith(mrRightWall))
            {
                // Reverse it's X direction
                mcBallDirection.X = -mcBallDirection.X;

                // Place it to be hitting the Wall (not in the Wall)
                mrBall.X = mrRightWall.Left - mrBall.Width;

                // Play Sound
                CFMOD.PlaySound(msSoundBallBounce, false);
            }

            // Test for collision between the Ball and the Paddle
            // NOTE: Test for collision between Paddle before left wall incase ball is
            //       travelling too fast and would pass through both
            if (rBallCollisionRect.IntersectsWith(mrPaddle))
            {
                // Increase the Balls speed slightly
                float fSpeed = mcBallDirection.Length();
                fSpeed += miBALL_SPEED_INCREMENT;

                // Make sure Ball does not go too fast
                if (fSpeed > miBALL_MAX_SPEED)
                {
                    fSpeed = miBALL_MAX_SPEED;
                }

                // Reverse the Balls X direction
                mcBallDirection.X = -mcBallDirection.X;

                // Add some randomness to the Balls Y direction
                float fRandomness = mcRandom.Next(-25, 25);
                fRandomness /= 100.0f;
                mcBallDirection.Normalize();
                mcBallDirection.Y += fRandomness;

                // Set the Balls speed
                mcBallDirection.Normalize();
                mcBallDirection.Scale(fSpeed);

                // Place the Ball on the Paddle (not inside it)
                mrBall.X = mrPaddle.Right;

                // Play Sound
                CFMOD.PlaySound(msSoundBallBounce, false);
            }
            // Else if the Ball hit the Left wall
            else if (rBallCollisionRect.IntersectsWith(mrLeftWall))
            {
                // Player loses a life
                miLives--;

                // If the Player is dead
                if (miLives == 0)
                {
                    // Save the Players Score
                    int iScore = miScore;

                    // Restart the Game
                    Reset();

                    // Restore the Players Score
                    miScore = iScore;

                    // Play Game Over sound
                    CFMOD.PlaySound(msSoundGameOver, false);

                    // Check if the Player has beat their High Score
                    if (CProfiles.Instance().mcCurrentProfile.iScoreSpong < miScore)
                    {
                        // Save the Players new High Score
                        CProfiles.Instance().mcCurrentProfile.iScoreSpong = miScore;
                        CProfiles.Instance().SaveProfilesToFile();
                    }

                    // Exit this function so the Game restarts now
                    return;
                }

                // Play sound of losing a Ball
                CFMOD.PlaySound(msSoundBallDied, false);

                // Reset the Balls position and direction
                ResetBall();

                // Reset the Next Ball Wait Timer
                mfNextBallWaitTime = 0.0f;

                // Enter the Wait For Next Ball state
                mePongState = EPongGameStates.WaitForNextBall;
            }

            // Update the Players Score
            miScore += (int)(fTimeSinceLastUpdateInSeconds * 1000.0f);
        }
Пример #17
0
        // Function to Update all of the Game Objects
        private void UpdateGameObjects(float fTimeSinceLastUpdateInSeconds, Graphics cBackBuffer)
        {
            // Loop through Midi Data and create new Targets if necessary
            int iMidiIndex         = 0;
            int iNumberOfMidiNotes = CMidiInput.Instance().cMidiInfoList.Count;

            for (iMidiIndex = 0; iMidiIndex < iNumberOfMidiNotes; iMidiIndex++)
            {
                // Create a handle to the current Midi Info for readability
                CMidiInfo cMidiInfo = CMidiInput.Instance().cMidiInfoList[iMidiIndex];

                // Filter Midi Notes based on which Music is playing
                // If this Midi Note is not on the Channel we want
                if (cMidiInfo.iChannel != mcCurrentMusic.iChannelToUse && cMidiInfo.iChannel > 0)
                {
                    // Move to the next Midi Note (only keep Notes on the desired Channel)
                    continue;
                }

                // Create a new Target
                CTarget cNewTarget = new CTarget();

                // Specify Target Width and Height
                cNewTarget.rRect.Width  = 70;
                cNewTarget.rRect.Height = 80;

                // Determine which Row the Target should be in
                // If it should be in the bottom Row
                if (cMidiInfo.iNote < mcCurrentMusic.iLowPitchCeiling)
                {
                    cNewTarget.rRect.Y = miBOTTOM_ROW_Y;
                }
                // Else if it should be in the middle Row
                else if (cMidiInfo.iNote < mcCurrentMusic.iMiddlePitchCeiling)
                {
                    cNewTarget.rRect.Y = miMIDDLE_ROW_Y;
                }
                // Else it should be in the top Row
                else
                {
                    cNewTarget.rRect.Y = miTOP_ROW_Y;
                }

                // Calculate the Targets velocity based on the Midi Note's Velocity
                cNewTarget.sVelocity.X = cMidiInfo.iVelocity + 140;
                cNewTarget.sVelocity.Y = 0.0f;

                // 50/50 chance of Target approaching from left/right side
                bool bApproachFromRight = (mcRandom.Next(0, 2) == 0) ? true : false;
                bApproachFromRight = false;

                // If this Target is approaching from the Right
                if (bApproachFromRight)
                {
                    // Reverse it's X Velocity
                    cNewTarget.sVelocity.X = -cNewTarget.sVelocity.X;

                    // Record that it should be Facing Left
                    cNewTarget.bFacingLeft = true;
                }

                // Save the Targets Starting Velocity
                cNewTarget.sStartingVelocity = cNewTarget.sVelocity;

                // Calculate the Time when the Target should reach the center of the screen
                cNewTarget.cTimeToBeAtCenter = cMidiInfo.cTime.AddSeconds(3.0);

                // Calculate how long between the current Time and the time the target
                // should be in the middle of the screen
                TimeSpan cTimeSpanToReachCenter = cNewTarget.cTimeToBeAtCenter - DateTime.Now;
                float    fTimeToReachCenter     = (float)(cTimeSpanToReachCenter.TotalMilliseconds / 1000.0f);

                // Calculate where it should be placed to reach the middle of the screen at the desired time
                cNewTarget.rRect.X = (int)(miCENTER_OF_SCREEN_X - (cNewTarget.sVelocity.X * fTimeToReachCenter)) + (cNewTarget.rRect.Width / 2.0f);

                // Add the new Target to the Target List
                mcTargetList.Add(cNewTarget);
            }

            // Temp variable to keep track of which Row the Players Pitch is in
            ETargetRows ePlayersPitchRow;

            // If the Player is making a sound
            if (CSoundInput.Instance().bInputReceived)
            {
                // If the Song is not still loading
                if (mcWindowsMediaPlayer.status != "Connecting...")
                {
                    // Duduct from their Score (so they don't make sounds the whole time)
                    miScore--;
                }

                // Save which Row their Pitch corresponds to
                // If the Pitch corresponds to the Bottom Row
                if (CSoundInput.Instance().fPitch < CSoundInput.Instance().iOneThirdOfPitchRange)
                {
                    ePlayersPitchRow = ETargetRows.Bottom;
                }
                // Else if the Pitch corresponds to the Middle Row
                else if (CSoundInput.Instance().fPitch < CSoundInput.Instance().iTwoThirdsOfPitchRange)
                {
                    ePlayersPitchRow = ETargetRows.Middle;
                }
                // Else the Pitch corresponds to the Top Row
                else
                {
                    ePlayersPitchRow = ETargetRows.Top;
                }
            }
            // Else no input was recieved
            else
            {
                ePlayersPitchRow = ETargetRows.None;
            }

            // Loop though all Targets in the Target List
            int iTargetIndex     = 0;
            int iNumberOfTargets = mcTargetList.Count;

            for (iTargetIndex = 0; iTargetIndex < iNumberOfTargets; iTargetIndex++)
            {
                // Save a handle to this Target for readability
                CTarget cTarget = mcTargetList[iTargetIndex];

                // Make sure the Targets Velocity will still put them at the
                // center of the screen at the correct time

                // If this target has not passed the middle of the screen yet
                if (cTarget.cTimeToBeAtCenter > DateTime.Now)
                {
                    // Calculate how long between the current Time and the time the target
                    // should be in the middle of the screen
                    TimeSpan cTimeSpanToReachCenter = cTarget.cTimeToBeAtCenter - DateTime.Now;
                    float    fTimeToReachCenter     = (float)(cTimeSpanToReachCenter.TotalMilliseconds / 1000.0f);

                    // Calculate the Distance this Target is from the Center of the screen
                    float fDistanceToCenter = miCENTER_OF_SCREEN_X - (cTarget.rRect.X + (cTarget.rRect.Width / 2.0f));

                    // Calculate where it should be placed to reach the middle of the screen at the desired time
                    cTarget.sVelocity.X = fDistanceToCenter / fTimeToReachCenter;

                    // If the Velocity should be negative and it isn't, or it should be positive and it isn't
                    if ((cTarget.sStartingVelocity.X < 0.0f && cTarget.sVelocity.X > 0.0f) ||
                        (cTarget.sStartingVelocity.X > 0.0f && cTarget.sVelocity.X < 0.0f))
                    {
                        // Make the Velocity
                        cTarget.sVelocity.X *= -1;
                    }
                }
                // Else it has passed the middle of the screen
                else
                {
                    // So make sure it is using it's original velocity
                    cTarget.sVelocity = cTarget.sStartingVelocity;
                }

                // Update the Position of this Target
                cTarget.rRect.X += (cTarget.sVelocity.X * fTimeSinceLastUpdateInSeconds);
                cTarget.rRect.Y += (cTarget.sVelocity.Y * fTimeSinceLastUpdateInSeconds);

                // Store which Row this Target is in
                ETargetRows eTargetRow;

                // If the Target is in the Top Row
                if (cTarget.rRect.Y == miTOP_ROW_Y)
                {
                    eTargetRow = ETargetRows.Top;
                }
                // Else if the Target is in the Middle Row
                else if (cTarget.rRect.Y == miMIDDLE_ROW_Y)
                {
                    eTargetRow = ETargetRows.Middle;
                }
                // Else the Target is in the Bottom Row
                else
                {
                    eTargetRow = ETargetRows.Bottom;
                }

                // Calculate the middle position of the Target
                float fMiddlePosition = cTarget.rRect.X + (cTarget.rRect.Width / 2.0f);

                // If the Player is making a Pitch correspond to the Row this Target is in
                // AND the Target is in the shooting area
                if (ePlayersPitchRow == eTargetRow &&
                    fMiddlePosition >= miSHOOT_TARGET_AREA_LEFT && fMiddlePosition <= miSHOOT_TARGET_AREA_RIGHT)
                {
                    // Give the Player some Points for hitting this Target
                    miScore += 25;

                    // Kill this Target by moving it off the screen
                    cTarget.rRect.X += (cTarget.sVelocity.X * 10.0f);
                }
            }

            // Remove all Targets from the List which have moved off the screen
            mcTargetList.RemoveAll(delegate(CTarget cTarget)
            {
                // Return if the Target has moved off the screen or not yet
                return((cTarget.sVelocity.X > 0.0f && cTarget.rRect.X > 800) ||
                       (cTarget.sVelocity.X < 0.0f && (cTarget.rRect.X + cTarget.rRect.Width) < 0));
            });

            // If the Song is finished playing
            if (mcWindowsMediaPlayer.status == "Stopped")
            {
                // Sum the amount of time passed since the song finished playing
                mfSecondsSongHasBeenCompleteFor += fTimeSinceLastUpdateInSeconds;

                // If the Song has been finished for 7 seconds
                if (mfSecondsSongHasBeenCompleteFor >= 7.0f)
                {
                    // Check which Song is being played
                    switch (mcCurrentMusic.eMusic)
                    {
                    default:
                    case EMusic.Simple:
                        // Save the Players Score if it's better than their old one
                        if (miScore > CProfiles.Instance().mcCurrentProfile.iScoreShootingGallerySong1)
                        {
                            // Save the Players new High Score
                            CProfiles.Instance().mcCurrentProfile.iScoreShootingGallerySong1 = miScore;
                            CProfiles.Instance().SaveProfilesToFile();
                        }
                        break;

                    case EMusic.DansMario:
                        // Save the Players Score if it's better than their old one
                        if (miScore > CProfiles.Instance().mcCurrentProfile.iScoreShootingGallerySong2)
                        {
                            // Save the Players new High Score
                            CProfiles.Instance().mcCurrentProfile.iScoreShootingGallerySong2 = miScore;
                            CProfiles.Instance().SaveProfilesToFile();
                        }
                        break;

                    case EMusic.Mario:
                        // Save the Players Score if it's better than their old one
                        if (miScore > CProfiles.Instance().mcCurrentProfile.iScoreShootingGallerySong3)
                        {
                            // Save the Players new High Score
                            CProfiles.Instance().mcCurrentProfile.iScoreShootingGallerySong3 = miScore;
                            CProfiles.Instance().SaveProfilesToFile();
                        }
                        break;
                    }

                    // Restart the game
                    Reset();
                }
            }
        }