Exemple #1
0
        public void DisplayLookAround()
        {
            //
            // get current dungeon location
            //
            DungeonLocation currentDungeonLocation = _gameDungeon.GetSpaceTimeLocationById(_gameAdventurer.DungeonLocationID);

            //
            // get list of game objects in the current dungeon location
            //
            List <GameObject> gameObjectsInCurrentDungeonLocation = _gameDungeon.GetGameObjectsByDungeonLocationId(_gameAdventurer.DungeonLocationID);

            //
            // get list of NPCs in current dungeon location
            //
            List <Npc> npcsInCurrentDungeonLocation = _gameDungeon.GetNpcsByDungeonLocationId(_gameAdventurer.DungeonLocationID);

            string messageBoxText = Text.LookAround(currentDungeonLocation) + Environment.NewLine + Environment.NewLine;

            messageBoxText += Text.GameObjectsChooseList(gameObjectsInCurrentDungeonLocation) + Environment.NewLine;
            messageBoxText += Text.NpcsChooseList(npcsInCurrentDungeonLocation);

            DisplayGamePlayScreen("Current Location", messageBoxText, ActionMenu.MainMenu, "");
        }
        /// <summary>
        /// method to manage the application setup and game loop
        /// </summary>
        private void ManageGameLoop()
        {
            AdventurerAction travelerActionChoice = AdventurerAction.None;

            //
            // display splash screen
            //
            _playingGame = _gameConsoleView.DisplaySpashScreen();

            //
            // player chooses to quit
            //
            if (!_playingGame)
            {
                Environment.Exit(1);
            }

            //
            // display introductory message
            //
            _gameConsoleView.DisplayGamePlayScreen("Mission Intro", Text.QuestIntro(), ActionMenu.QuestIntro, "");
            _gameConsoleView.GetContinueKey();

            //
            // initialize the mission adventurer
            //
            InitializeMission();

            //
            // prepare game play screen
            //
            _currentLocation = _gameDungeon.GetSpaceTimeLocationById(_gameAdventurer.DungeonLocationID);
            _gameConsoleView.DisplayGamePlayScreen("Current Location", Text.CurrrentLocationInfo(), ActionMenu.MainMenu, "");

            //
            // game loop
            //
            while (_playingGame)
            {
                //
                // process all flags, events, and stats
                //
                UpdateGameStatus();

                //
                // get next game action from player
                //
                travelerActionChoice = GetNextAdventurerAction();

                //
                // choose an action based on the player's menu choice
                //
                switch (travelerActionChoice)
                {
                case AdventurerAction.None:
                    break;

                case AdventurerAction.AdventurerInfo:
                    _gameConsoleView.DisplayAdventurerInfo();
                    break;

                case AdventurerAction.ListDungeonLocations:
                    _gameConsoleView.DisplayListOfDungeonLocations();
                    break;

                case AdventurerAction.LookAround:
                    _gameConsoleView.DisplayLookAround();
                    break;

                case AdventurerAction.Travel:
                    //
                    // get new location choice and update the current location property
                    //
                    _gameAdventurer.DungeonLocationID = _gameConsoleView.DisplayGetNextDungeonLocation();
                    _currentLocation = _gameDungeon.GetSpaceTimeLocationById(_gameAdventurer.DungeonLocationID);

                    //
                    // set the game play screen to the current location info format
                    //
                    _gameConsoleView.DisplayGamePlayScreen("Current Location", Text.CurrentLocationInfo(_currentLocation), ActionMenu.MainMenu, "");
                    //
                    // play sound when you travel
                    //
                    //_gameSound.PlaySoundTravel();
                    break;

                case AdventurerAction.AdventurerLocationsVisited:
                    _gameConsoleView.DisplayLocationsVisited();
                    break;

                case AdventurerAction.ListGameObjects:
                    _gameConsoleView.DisplayListOfAllGameObjects();
                    break;

                case AdventurerAction.ListNonPlayerCharacters:
                    _gameConsoleView.DisplayListOfAllNpcObjects();
                    break;

                case AdventurerAction.LookAt:
                    LookAtAction();
                    break;

                case AdventurerAction.PickUp:
                    PickUpAction();
                    break;

                case AdventurerAction.PutDown:
                    PutDownAction();
                    break;

                case AdventurerAction.TalkTo:
                    TalkToAction();
                    //_gameSound.PlaySoundTalkTo();
                    break;

                case AdventurerAction.Inventory:
                    _gameConsoleView.DisplayInventory();
                    //_gameSound.PlaySoundInventory();
                    break;

                case AdventurerAction.EditAdventurerInfo:
                    _gameConsoleView.DisplayEditAdventurerInfo(_gameAdventurer);
                    break;

                case AdventurerAction.AdminMenu:
                    ActionMenu.currentMenu = ActionMenu.CurrentMenu.AdminMenu;
                    _gameConsoleView.DisplayGamePlayScreen("Admin Menu", "Select an operation from the menu.", ActionMenu.AdminMenu, "");
                    break;

                case AdventurerAction.ReturnToMainMenu:
                    ActionMenu.currentMenu = ActionMenu.CurrentMenu.MainMenu;
                    _gameConsoleView.DisplayGamePlayScreen("Current Location", Text.CurrentLocationInfo(_currentLocation), ActionMenu.MainMenu, "");
                    break;

                case AdventurerAction.AdventurerMenu:
                    ActionMenu.currentMenu = ActionMenu.CurrentMenu.AdventurerMenu;
                    _gameConsoleView.DisplayGamePlayScreen("Adventurer Menu", "Select an operation from the menu.", ActionMenu.AdventurerMenu, "");
                    break;

                case AdventurerAction.ObjectMenu:
                    ActionMenu.currentMenu = ActionMenu.CurrentMenu.ObjectMenu;
                    _gameConsoleView.DisplayGamePlayScreen("Object Menu", "Select an operation from the menu.", ActionMenu.ObjectMenu, "");
                    break;

                case AdventurerAction.NonPlayerCharacterMenu:
                    ActionMenu.currentMenu = ActionMenu.CurrentMenu.NpcMenu;
                    _gameConsoleView.DisplayGamePlayScreen("NPC Menu", "Select an operation from the menu.", ActionMenu.NpcMenu, "");
                    break;

                case AdventurerAction.Exit:
                    //_gameSound.PlaySoundExit();
                    _playingGame = false;
                    break;

                default:
                    break;
                }
            }

            //
            // close the application
            //
            Environment.Exit(1);
        }