示例#1
0
        // Update:
        public override void Update(GameTime gameTime, KeyboardState ks)
        {
            base.Update(gameTime, ks);

            // Move Menu Selection Up:
            if (km.ActionPressed(KeyboardManager.action.up, KeyboardManager.playerIndex.all))
            {
                // SFX:
                parentManager.audioEngine.playSound(MGP_Constants.soundEffects.menuSelect, MGP_Constants.MENU_SFX_VOLUME);

                currentMenuItem = items[currentMenuItem].above.activeValue;
                moveGlove       = true;
            }

            // Move Menu Selection Down:
            if (km.ActionPressed(KeyboardManager.action.down, KeyboardManager.playerIndex.all))
            {
                // SFX:
                parentManager.audioEngine.playSound(MGP_Constants.soundEffects.menuSelect, MGP_Constants.MENU_SFX_VOLUME);

                currentMenuItem = items[currentMenuItem].below.activeValue;
                moveGlove       = true;
            }

            // Move glove
            if (moveGlove)
            {
                if (Vector2.Distance(glovePos, new Vector2(items[currentMenuItem].xPos - 60, items[currentMenuItem].yPos - 35)) < 1.0f)
                {
                    moveGlove = false;
                }
                else
                {
                    glovePos.Y = MGP_Tools.Ease(glovePos.Y, items[currentMenuItem].yPos - 35, 0.5f);
                }
            }

            // Press ENTER while some menu item is highlighted:
            if (km.ActionPressed(KeyboardManager.action.select, KeyboardManager.playerIndex.all))
            {
                // SFX:
                parentManager.audioEngine.playSound(MGP_Constants.soundEffects.diceHit, MGP_Constants.MENU_SFX_VOLUME + 0.15f);

                // Difficulty: Easy
                if (currentMenuItem == (int)MenuItem.Difficulty.EASY)
                {
                    parentManager.gameOptions.difficulty = MenuItem.Difficulty.EASY;
                }

                // Difficulty: Medium
                if (currentMenuItem == (int)MenuItem.Difficulty.MEDIUM)
                {
                    parentManager.gameOptions.difficulty = MenuItem.Difficulty.MEDIUM;
                }

                // Difficulty: Medium
                if (currentMenuItem == (int)MenuItem.Difficulty.HARD)
                {
                    parentManager.gameOptions.difficulty = MenuItem.Difficulty.HARD;
                }

                // Go to next menu
                S_NumRoundsMenu numRoundsMenu = new S_NumRoundsMenu(parentManager, 0, 0);
                parentManager.AddStateQueue(numRoundsMenu);
                this.flagForDeletion = true;
            }

            // Press Cancel Key: Goes back to Player Count menu:
            if (km.ActionPressed(KeyboardManager.action.cancel, KeyboardManager.playerIndex.all))
            {
                // SFX:
                parentManager.audioEngine.playSound(MGP_Constants.soundEffects.menuCancel, MGP_Constants.MENU_SFX_VOLUME);

                S_PlayerCountMenu playerCountMenu = new S_PlayerCountMenu(parentManager, 0, 0);
                parentManager.AddStateQueue(playerCountMenu);
                this.flagForDeletion = true;
            }
        }
示例#2
0
        // Update:
        public override void Update(GameTime gameTime, KeyboardState ks)
        {
            base.Update(gameTime, ks);

            // Move Menu Selection Up:
            if (km.ActionPressed(KeyboardManager.action.up, KeyboardManager.playerIndex.all))
            {
                // SFX:
                parentManager.audioEngine.playSound(MGP_Constants.soundEffects.menuSelect, MGP_Constants.MENU_SFX_VOLUME);

                if (currentMenuItem == 1)
                {
                    currentMenuItem = 0;
                }
                moveGlove = true;
            }

            // Move Menu Selection Down:
            if (km.ActionPressed(KeyboardManager.action.down, KeyboardManager.playerIndex.all))
            {
                // SFX:
                parentManager.audioEngine.playSound(MGP_Constants.soundEffects.menuSelect, MGP_Constants.MENU_SFX_VOLUME);

                if (currentMenuItem == 0)
                {
                    currentMenuItem = 1;
                }
                moveGlove = true;
            }

            // Move glove
            if (moveGlove)
            {
                if (Vector2.Distance(glovePos, new Vector2(items[currentMenuItem].xPos - 60, items[currentMenuItem].yPos - 35)) < 1.0f)
                {
                    moveGlove = false;
                }
                else
                {
                    glovePos.Y = MGP_Tools.Ease(glovePos.Y, items[currentMenuItem].yPos - 35, 0.5f);
                }
            }

            // Press ENTER while some menu item is highlighted:
            if (km.ActionPressed(KeyboardManager.action.select, KeyboardManager.playerIndex.all))
            {
                // SFX:
                parentManager.audioEngine.playSound(MGP_Constants.soundEffects.diceHit, MGP_Constants.MENU_SFX_VOLUME + 0.15f);

                // Allow Bonuses
                if (currentMenuItem == 0)
                {
                    parentManager.gameOptions.allowBonus = true;
                }

                // No Bonuses
                if (currentMenuItem == 1)
                {
                    parentManager.gameOptions.allowBonus = false;
                }


                // DEBUG: PRINT GAME OPTIONS
                Console.WriteLine("Map: " + parentManager.gameOptions.mapName +
                                  "\nPlayer Count: " + parentManager.gameOptions.numPlayers);
                int x = 1;
                foreach (Player player in parentManager.gameOptions.players)
                {
                    Console.WriteLine("Character " + x + ": " + player.type);
                    x++;
                }
                Console.WriteLine("Difficulty: " + parentManager.gameOptions.difficulty +
                                  "\nRound Count: " + parentManager.gameOptions.numRounds +
                                  "\nAllow Bonuses: " + parentManager.gameOptions.allowBonus + "\n");



                // Start game based on game options from here.
                S_Board board = new B_PirateBay(parentManager, 0, 0);
                parentManager.AddStateQueue(board);

                // Add UI to game:
                board.playerUI = new S_PlayerUI(parentManager, 0, 0);
                parentManager.AddStateQueue(board.playerUI);

                this.flagForDeletion = true;
            }

            // Press Cancel Key: Goes back one menu:
            if (km.ActionPressed(KeyboardManager.action.cancel, KeyboardManager.playerIndex.all))
            {
                // SFX:
                parentManager.audioEngine.playSound(MGP_Constants.soundEffects.menuCancel, MGP_Constants.MENU_SFX_VOLUME);

                S_NumRoundsMenu numRoundsMenu = new S_NumRoundsMenu(parentManager, 0, 0);
                parentManager.AddStateQueue(numRoundsMenu);
                this.flagForDeletion = true;
            }
        }