Beispiel #1
0
        /// <summary>
        /// Triggered when the user releases or presses a key.
        /// </summary>
        public void Key(KeyboardEventArgs args)
        {
            // We only care about keyboard presses
            if (!args.Pressed)
                return;

            // Switch the mode
            switch (args.Key)
            {
            case BooGameKeys.Escape:
                // Go to the main menu
                Game.GameMode = new MainMenuMode();
                break;

            #if DEBUG
            case BooGameKeys.F3:
                // Add to the minor mode if we already have one
                if (MinorMode != null && MinorMode is ChestOpenedMinorMode)
                {
                    // Just increment it
                    (MinorMode as ChestOpenedMinorMode).ChestCounter++;
                }
                else
                {
                    // Open up the new mode
                    MinorMode = new ChestOpenedMinorMode(1);
                }
                return;

            case BooGameKeys.F4:
                // Add a bug into the board
                Game.State.Board.AddBugs(1);
                return;

            case BooGameKeys.F5:
                // Give another stage with penalties
                MinorMode = new NewStageMinorMode();
                return;

            case BooGameKeys.F6:
                // Creates a test prayer and inserts it into the system.
                Prayer prayer = Game.PrayerFactory.CreatePrayer();
                prayer.IsAccepted = true;
                Game.State.Prayers.Add(prayer);
                return;

            case BooGameKeys.F7:
                Game.State.GrabCount = 3;
                return;

            case BooGameKeys.F8:
                // Finish up a prayer
                Prayer p = Game.PrayerFactory.CreatePrayer();
                MinorMode = new PrayerCompletedMinorMode(0, 0, p);
                return;

            case BooGameKeys.F9:
                // Finish the game
                MinorMode = new EndOfGameMinorMode();
                return;
            #endif
            }

            // If we have a minor mode, pass it on
            if (minorMode != null)
                minorMode.Key(args);
        }
Beispiel #2
0
        /// <summary>
        /// Triggered when the user releases or presses a key.
        /// </summary>
        public void Key(KeyboardEventArgs args)
        {
            // We only care about keyboard presses
            if (!args.Pressed)
            {
                return;
            }

            // Switch the mode
            switch (args.Key)
            {
            case BooGameKeys.Escape:
                // Go to the main menu
                Game.GameMode = new MainMenuMode();
                break;

#if DEBUG
            case BooGameKeys.F3:
                // Add to the minor mode if we already have one
                if (MinorMode != null && MinorMode is ChestOpenedMinorMode)
                {
                    // Just increment it
                    (MinorMode as ChestOpenedMinorMode).ChestCounter++;
                }
                else
                {
                    // Open up the new mode
                    MinorMode = new ChestOpenedMinorMode(1);
                }
                return;

            case BooGameKeys.F4:
                // Add a bug into the board
                Game.State.Board.AddBugs(1);
                return;

            case BooGameKeys.F5:
                // Give another stage with penalties
                MinorMode = new NewStageMinorMode();
                return;

            case BooGameKeys.F6:
                // Creates a test prayer and inserts it into the system.
                Prayer prayer = Game.PrayerFactory.CreatePrayer();
                prayer.IsAccepted = true;
                Game.State.Prayers.Add(prayer);
                return;

            case BooGameKeys.F7:
                Game.State.GrabCount = 3;
                return;

            case BooGameKeys.F8:
                // Finish up a prayer
                Prayer p = Game.PrayerFactory.CreatePrayer();
                MinorMode = new PrayerCompletedMinorMode(0, 0, p);
                return;

            case BooGameKeys.F9:
                // Finish the game
                MinorMode = new EndOfGameMinorMode();
                return;
#endif
            }

            // If we have a minor mode, pass it on
            if (minorMode != null)
            {
                minorMode.Key(args);
            }
        }