public int iMiddlePitchCeiling; // The ceiling of the Middle Pitch zone (i.e. Middle Row)

            // Constructor
            public CMusic(EMusic _eMusic, int _iChannelToUse, int _iLowPitchCeiling, int _iMiddlePitchCeiling)
            {
                eMusic              = _eMusic;
                iChannelToUse       = _iChannelToUse;
                iLowPitchCeiling    = _iLowPitchCeiling;
                iMiddlePitchCeiling = _iMiddlePitchCeiling;
            }
 public void PlayMusic(EMusic anEnum)
 {
     if (anEnum == EMusic.NONE)
     {
         return;
     }
     myMusic[(int)anEnum].Play();
 }
 // If the Mouse was Moved
 public override void MouseMove(MouseEventArgs e)
 {
     // If Mario should be Highlighted
     if (e.Y < 240)
     {
         meHighlightedMusic = EMusic.Simple;
     }
     // Else if Simple should be Highlighted
     else if (e.Y < 290)
     {
         meHighlightedMusic = EMusic.DansMario;
     }
     // Else DansMario should be Highlighted
     else
     {
         meHighlightedMusic = EMusic.Mario;
     }
 }
        // Reset class variables to their default values
        public void Reset()
        {
            // Record that we are playing Pong
            meGame = EGames.ShootingGallery;

            // Set the games initial State
            meShootingGalleryState = EShootingGalleryGameStates.ChoosingSong;

            // Set the default Music to use
            meHighlightedMusic = EMusic.Mario;
            mcCurrentMusic     = mcMARIO_MUSIC;

            // Stop any Music that might be playing
            mcWindowsMediaPlayer.Ctlcontrols.stop();

            // Reset the duration the Song has been done playing for
            mfSecondsSongHasBeenCompleteFor = 0.0f;

            // Create the Target List
            mcTargetList = new List <CTarget>();
        }
Exemple #5
0
 public void PlayMusic(EMusic music)
 {
     MusicSource.clip = AllMusic[music];
     MusicSource.Play();
 }
 static void Clear()
 {
     Enemies     = new List <Enemy>();
     AMusic      = 0;
     ABackground = 0;
 }
        // Handle key presses
        public override EGames KeyDown(KeyEventArgs e)
        {
            // If the Pause button is pressed
            if (e.KeyCode == Keys.Space)
            {
                // If we are currently Playing the Game
                if (meShootingGalleryState == EShootingGalleryGameStates.Play)
                {
                    // Pause the music
                    mcWindowsMediaPlayer.Ctlcontrols.pause();

                    // Pause the Game
                    meShootingGalleryState = EShootingGalleryGameStates.Pause;
                }
                // Else if the Game is currently Paused
                else if (meShootingGalleryState == EShootingGalleryGameStates.Pause)
                {
                    // Start the music
                    mcWindowsMediaPlayer.Ctlcontrols.play();

                    // Play the Game
                    meShootingGalleryState = EShootingGalleryGameStates.Play;
                }
                // Don't Pause if currently choosing a Song
            }

            // If we are Choosing a Song
            if (meShootingGalleryState == EShootingGalleryGameStates.ChoosingSong)
            {
                // If the Player wants to play with the Highlighted Song
                if (e.KeyCode == Keys.Enter || e.KeyCode == Keys.Space)
                {
                    StartPlayingWithCurrentlyHightlightedSong();
                }
            }

            // If the Player wants to change the Highlighted Song
            // If Up was pressed
            if (e.KeyCode == Keys.Up)
            {
                // Highlight the Previous song
                meHighlightedMusic--;

                // Wrap around
                if (meHighlightedMusic < 0)
                {
                    meHighlightedMusic = EMusic.DansMario;
                }
            }
            // Else if Down was pressed
            else if (e.KeyCode == Keys.Down)
            {
                // Highlight the Next song
                meHighlightedMusic++;

                // Wrap around
                if (meHighlightedMusic > EMusic.DansMario)
                {
                    meHighlightedMusic = 0;
                }
            }

            // If the Restart button is pressed
            if (e.KeyCode == Keys.R)
            {
                // Return to Choosing a Song
                Reset();
            }

            return(meGame);
        }