Esempio n. 1
0
        public void Update(GameTime gameTime, ref GameStates gameState, ref Level level)
        {
            /* If the user hits up */
            if (mControls.isUpPressed(false))
            {
                /* If we are not on the first element already */
                if (mCurrent > 0)
                {
                    GameSound.menuSound_rollover.Play(GameSound.volume, 0.0f, 0.0f);
                    /* Decrement current and change the images */
                    mCurrent--;
                    for (int i = 0; i < NUM_OPTIONS; i++)
                        mItems[i] = mUnselItems[i];
                    mItems[mCurrent] = mSelItems[mCurrent];
                }
            }
            /* If the user hits the down button */
            if (mControls.isDownPressed(false))
            {
                /* If we are on the last element in the menu */
                if (mCurrent < NUM_OPTIONS - 1)
                {
                    GameSound.menuSound_rollover.Play(GameSound.volume, 0.0f, 0.0f);
                    /* Increment current and update graphics */
                    mCurrent++;
                    for (int i = 0; i < NUM_OPTIONS; i++)
                        mItems[i] = mUnselItems[i];
                    mItems[mCurrent] = mSelItems[mCurrent];
                }
            }
            /* If the user selects a menu item */
            if (mControls.isAPressed(false) || mControls.isStartPressed(false))
            {
                GameSound.menuSound_select.Play(GameSound.volume, 0.0f, 0.0f);
                /* Continue */
                if (mCurrent == 0)
                {
                    gameState = GameStates.New_Level_Selection;
                    level.Reset();
                    mCurrent = 1;

                    for (int i = 0; i < NUM_OPTIONS; i++)
                        mItems[i] = mUnselItems[i];
                    mItems[mCurrent] = mSelItems[mCurrent];
                }
                /* Back */
                else if (mCurrent == 1)
                {
                    gameState = GameStates.Options;

                }
            }
        }
Esempio n. 2
0
        public void Update(GameTime gameTime, ref GameStates gameState, ref Level level)
        {
            /* If the user hits up */
            if (mControls.isUpPressed(false))
            {
                /* If we are not on the first element already */
                if (mCurrent > 0)
                {
                    GameSound.menuSound_rollover.Play(GameSound.volume, 0.0f, 0.0f);
                    /* Decrement current and change the images */
                    mCurrent--;
                    for (int i = 0; i < NUM_OPTIONS; i++)
                        mItems[i] = mUnselItems[i];
                    mItems[mCurrent] = mSelItems[mCurrent];
                }
            }
            /* If the user hits the down button */
            if (mControls.isDownPressed(false))
            {
                /* If we are on the last element in the menu */
                if (mCurrent < NUM_OPTIONS - 1)
                {
                    GameSound.menuSound_rollover.Play(GameSound.volume, 0.0f, 0.0f);
                    /* Increment current and update graphics */
                    mCurrent++;
                    for (int i = 0; i < NUM_OPTIONS; i++)
                        mItems[i] = mUnselItems[i];
                    mItems[mCurrent] = mSelItems[mCurrent];
                }
            }
            if (mControls.isBPressed(false) || mControls.isBackPressed(false))
            {
                mCurrent = 0;
                gameState = GameStates.In_Game;

                mItems[0] = mResumeSel;
                mItems[1] = mRestartUnsel;
                mItems[2] = mSelectLevelUnsel;
                mItems[3] = mMainMenuUnsel;
            }
            /* If the user selects a menu item */
            if (mControls.isAPressed(false) || mControls.isStartPressed(false))
            {
                 GameSound.menuSound_select.Play(GameSound.volume, 0.0f, 0.0f);
                /* Resume Game */
                 if (mCurrent == 0)
                     gameState = GameStates.In_Game;
                 /* Restart */
                 else if (mCurrent == 1)
                 {
                     level.ResetAll();
                     gameState = GameStates.StartLevelSplash;
                     mCurrent = 0;
                 }
                 /* Select Level */
                 else if (mCurrent == 2)
                 {
                     gameState = GameStates.Level_Selection;
                     level.Reset();
                     mCurrent = 0;
                 }
                 /* Main Menu */
                 else if (mCurrent == 3)
                 {
                     gameState = GameStates.Main_Menu;
                     level.Reset();
                     mCurrent = 0;
                 }

                 mItems[0] = mResumeSel;
                 mItems[1] = mRestartUnsel;
                 mItems[2] = mSelectLevelUnsel;
                 mItems[3] = mMainMenuUnsel;
            }
        }