예제 #1
0
        private void HandleLevelUpKeys(ResultSet resultSet)
        {
            var game = (RetroDungeoneerGame)RB.Game;

            if (RB.ButtonPressed(RB.BTN_SYSTEM))
            {
                resultSet.AddExit();
                return;
            }

            int index = -1;

            for (char i = 'a'; i <= 'c'; i++)
            {
                if (RB.KeyPressed((KeyCode)i))
                {
                    index = (int)(i - 'a');
                    break;
                }
            }

            // Check if pointer clicked on any of the items
            if (RB.ButtonReleased(RB.BTN_POINTER_A))
            {
                if (mMenuInventory.pointerIndex >= 0 && mMenuInventory.pointerIndex <= 2)
                {
                    index = mMenuInventory.pointerIndex;
                }
            }

            LevelUp levelUp = LevelUp.None;

            if (index >= 0 && index <= 2)
            {
                switch (index)
                {
                case 0:
                    levelUp = LevelUp.Hp;
                    break;

                case 1:
                    levelUp = LevelUp.Str;
                    break;

                case 2:
                    levelUp = LevelUp.Def;
                    break;
                }

                resultSet.AddLevelUp(levelUp);

                RB.SoundPlay(game.assets.soundSelectOption, 1, RandomUtils.RandomPitch(0.1f));
            }
        }