示例#1
0
        public void DisplayLookAround()
        {
            //
            // get current island location
            //
            IslandLocation currentIslandLocation = _gameUniverse.GetIslandLocationById(_gameSurvivor.IslandLocationID);

            //
            // get list of game objects in current space-time location
            //
            List <GameObject> gameObjectsInCurrentIslandLocation = _gameUniverse.GetGameObjectsByIslandLocationId(_gameSurvivor.IslandLocationID);

            //
            // get list of NPCs in current space-time location
            //
            List <Npc> npcsInCurrentIslandLocation = _gameUniverse.GetNpcsBySpaceTimeLocationId(_gameSurvivor.IslandLocationID);

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

            messageBoxText += Text.GameObjectsChooseList(gameObjectsInCurrentIslandLocation);
            messageBoxText += Text.NpcsChooseList(npcsInCurrentIslandLocation);

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

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

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

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

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

            //
            // prepare game play screen
            //
            _currentLocation = _gameUniverse.GetIslandLocationById(_gamePirate.IslandLocationId);
            _gameConsoleView.DisplayGamePlayScreen("Current Location", Text.CurrentLocationInfo(_currentLocation), ActionMenu.MainMenu, "");
            _gameConsoleView.DisplayColoredText("", PlayerAction.ReturnToMainMenu, _currentLocation);

            //
            // game loop
            //
            while (_playingGame)
            {
                Console.CursorVisible = false;


                //
                // update all game stats/info
                //
                UpdateGameStatus();

                //
                // get game action from player
                //
                if (ActionMenu.currentMenu == ActionMenu.CurrentMenu.MainMenu)
                {
                    travelerActionChoice = _gameConsoleView.GetActionMenuChoice(ActionMenu.MainMenu);
                }
                else if (ActionMenu.currentMenu == ActionMenu.CurrentMenu.AdminMenu)
                {
                    travelerActionChoice = _gameConsoleView.GetActionMenuChoice(ActionMenu.AdminMenu);
                }

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

                case PlayerAction.EditPlayerInfo:
                    _gameConsoleView.DisplayEditPirateInformation();

                    //
                    // display game play screen with current location info and coordiantes
                    //
                    _gameConsoleView.DisplayGamePlayScreen("Current Location", Text.CurrentLocationInfo(_currentLocation), ActionMenu.MainMenu, "");
                    _gameConsoleView.DisplayColoredText("", PlayerAction.LookAround, _currentLocation);
                    break;

                case PlayerAction.PlayerInfo:
                    _gameConsoleView.DisplayPirateInfo();
                    _gameConsoleView.DisplayColoredText("", travelerActionChoice, _currentLocation);
                    break;

                case PlayerAction.ListDestinations:
                    _gameConsoleView.DisplayListOfIslandLocations();
                    _gameConsoleView.DisplayColoredText("", travelerActionChoice, _currentLocation);
                    break;

                case PlayerAction.ListGameObjects:
                    _gameConsoleView.DisplayListOfAllGameObjects();
                    _gameConsoleView.DisplayColoredText("", travelerActionChoice, _currentLocation);
                    break;

                case PlayerAction.LookAround:
                    _gameConsoleView.DisplayLookAround();
                    _gameConsoleView.DisplayColoredText("", travelerActionChoice, _currentLocation);
                    break;

                case PlayerAction.LookAt:
                    LookAtAction();
                    break;

                case PlayerAction.Travel:
                    //
                    // determine if the player has a ship in order to travel
                    //
                    if (_gamePirate.Ship == Ship.ShipType.None)
                    {
                        _gamePirate.ShipOwner = false;
                        _gameConsoleView.DisplayInputErrorMessage("You currently do not own a ship needed to travel. Obtain a ship, and try again.");
                        break;
                    }
                    else
                    {
                        _gamePirate.ShipOwner = true;
                    }

                    //
                    // get new location choice and update current location
                    //
                    _gamePirate.IslandLocationId = _gameConsoleView.DisplayGetNextIslandLocation();
                    _currentLocation             = _gameUniverse.GetIslandLocationById(_gamePirate.IslandLocationId);

                    //
                    // display game play screen with current location info and coordiantes
                    //
                    _gameConsoleView.DisplayGamePlayScreen("Current Location", Text.CurrentLocationInfo(_currentLocation), ActionMenu.MainMenu, "");
                    _gameConsoleView.DisplayColoredText("", PlayerAction.ReturnToMainMenu, _currentLocation);
                    break;

                case PlayerAction.PirateLocationsVisited:
                    _gameConsoleView.DisplayLocationsVisited();
                    _gameConsoleView.DisplayColoredText("", travelerActionChoice, _currentLocation);
                    break;

                case PlayerAction.AdminMenu:
                    ActionMenu.currentMenu = ActionMenu.CurrentMenu.AdminMenu;

                    _gameConsoleView.DisplayGamePlayScreen("Admin Menu", "Select an operation from the menu.", ActionMenu.AdminMenu, "");;
                    break;

                case PlayerAction.ReturnToMainMenu:
                    ActionMenu.currentMenu = ActionMenu.CurrentMenu.MainMenu;

                    _gameConsoleView.DisplayGamePlayScreen("Current Location", Text.CurrentLocationInfo(_currentLocation), ActionMenu.MainMenu, "");
                    _gameConsoleView.DisplayColoredText("", travelerActionChoice, _currentLocation);
                    break;

                case PlayerAction.Inventory:
                    _gameConsoleView.DisplayInventory();
                    break;

                case PlayerAction.TreasureInventory:
                    _gameConsoleView.DisplayTreasureInventory();
                    break;

                case PlayerAction.PickUp:
                    PickUpAction();
                    break;

                case PlayerAction.PutDown:
                    PutDownAction();
                    break;

                case PlayerAction.Exit:
                    _gameConsoleView.DisplayClosingScreen();
                    _playingGame = false;
                    break;

                default:
                    break;
                }
            }

            //
            // close the application
            //
            Environment.Exit(1);
        }
示例#3
0
        /// <summary>
        /// method to manage the application setup and game loop
        /// </summary>
        private void ManageGameLoop()
        {
            SurvivorAction survivorActionChoice = SurvivorAction.None;

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

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

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

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

            //
            // prepare game play screen
            //
            _currentLocation = _gameUniverse.GetIslandLocationById(_gameSurvivor.IslandLocationID);
            _gameConsoleView.DisplayGamePlayScreen("Current Location", Text.CurrentLocationInfo(_gameUniverse.GetIslandLocationById(_gameSurvivor.IslandLocationID)), ActionMenu.MainMenu, "");

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

                //
                // get next game action from player
                //
                survivorActionChoice = GetNextTravelerAction();

                //
                // choose an action based on the user's menu choice
                //
                switch (survivorActionChoice)
                {
                case SurvivorAction.None:
                    break;

                case SurvivorAction.SurvivorInfo:
                    _gameConsoleView.DisplaySurvivorInfo();
                    break;

                case SurvivorAction.SurvivorEditInfo:
                    _gameConsoleView.EditSurvivorInfo(_gameSurvivor);
                    break;

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

                case SurvivorAction.LookAt:
                    LookAtAction();
                    break;

                case SurvivorAction.PickUp:
                    PickUpAction();
                    break;

                case SurvivorAction.PutDown:
                    PutDownAction();
                    break;

                case SurvivorAction.InteractWith:
                    InteractWithAction();
                    break;

                case SurvivorAction.Inventory:
                    _gameConsoleView.DisplayInventory();
                    break;

                case SurvivorAction.Travel:
                    //
                    // get new location choice and update the current location property
                    //
                    _gameSurvivor.IslandLocationID = _gameConsoleView.DisplayGetNextIslandLocation();
                    _currentLocation = _gameUniverse.GetIslandLocationById(_gameSurvivor.IslandLocationID);

                    //
                    // set the game play screen to the current location info format
                    //
                    _gameConsoleView.DisplayGamePlayScreen("Current Location", Text.CurrentLocationInfo(_currentLocation), ActionMenu.MainMenu, "");

                    UpdateGameStatus(_playingGame);
                    break;

                case SurvivorAction.SurvivorLocationsVisited:
                    _gameConsoleView.DisplayLocationsVisited();
                    break;

                case SurvivorAction.ListIslandLocations:
                    _gameConsoleView.DisplayListOfIslandLocations();
                    break;

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

                case SurvivorAction.ListNonplayerCharacters:
                    _gameConsoleView.DisplayListOfAllNpcObjects();
                    break;

                case SurvivorAction.SurvivorMenu:
                    ActionMenu.currentMenu = ActionMenu.CurrentMenu.TravelerMenu;
                    _gameConsoleView.DisplayGamePlayScreen("Traveler Menu", "Select an operation from the menu.", ActionMenu.SurvivorMenu, "");
                    break;

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

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

                case SurvivorAction.TalkTo:
                    TalkToAction();
                    break;

                case SurvivorAction.AskToScavenge:
                    AskToScavenge();
                    break;

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

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

                case SurvivorAction.Exit:
                    _playingGame = false;
                    break;

                default:
                    break;
                }
            }

            //
            // close the application
            //
            Environment.Exit(1);
        }
示例#4
0
        /// <summary>
        /// method to manage the application setup and game loop
        /// </summary>
        private void ManageGameLoop()
        {
            PlayerAction travelerActionChoice = PlayerAction.None;

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

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

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

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

            //
            // prepare game play screen
            //
            _currentLocation = _gameUniverse.GetIslandLocationById(_gamePirate.IslandLocationId);
            _gameConsoleView.DisplayGamePlayScreen("Current Location", Text.CurrentLocationInfo(_currentLocation), ActionMenu.MainMenu, "");
            _gameConsoleView.DisplayColoredText("", PlayerAction.ReturnToMainMenu, _currentLocation);

            //
            // game loop
            //
            while (_playingGame)
            {
                Console.CursorVisible = false;


                //
                // update all game stats/info
                //
                UpdateGameStatus();

                //
                // get game action from player
                //
                travelerActionChoice = GetNextPlayerAction();

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

                case PlayerAction.PlayerMenu:
                    ActionMenu.currentMenu = ActionMenu.CurrentMenu.PlayerMenu;
                    _gameConsoleView.DisplayGamePlayScreen("Player Menu", "Select an operation from the menu.", ActionMenu.PlayerMenu, "");
                    break;

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

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

                case PlayerAction.EditPlayerInfo:
                    _gameConsoleView.DisplayEditPirateInformation();

                    //
                    // display game play screen with current location info and coordiantes
                    //
                    _gameConsoleView.DisplayGamePlayScreen("Current Location", Text.CurrentLocationInfo(_currentLocation), ActionMenu.MainMenu, "");
                    _gameConsoleView.DisplayColoredText("", PlayerAction.ReturnToMainMenu, _currentLocation);
                    break;

                case PlayerAction.PlayerInfo:
                    _gameConsoleView.DisplayPirateInfo();
                    _gameConsoleView.DisplayColoredText("", travelerActionChoice, _currentLocation);
                    break;

                case PlayerAction.ListDestinations:
                    _gameConsoleView.DisplayListOfIslandLocations();
                    _gameConsoleView.DisplayColoredText("", travelerActionChoice, _currentLocation);
                    break;

                case PlayerAction.ListGameObjects:
                    _gameConsoleView.DisplayListOfAllGameObjects();
                    _gameConsoleView.DisplayColoredObjects(travelerActionChoice, 0);
                    break;

                case PlayerAction.ListNpcs:
                    _gameConsoleView.DisplayListOfAllNpcs();
                    _gameConsoleView.DisplayColoredNpcs(travelerActionChoice);
                    break;

                case PlayerAction.LookAround:
                    _gameConsoleView.DisplayLookAround();
                    _gameConsoleView.DisplayColoredText("", travelerActionChoice, _currentLocation);
                    _gameConsoleView.DisplayColoredObjects(travelerActionChoice, 0);
                    _gameConsoleView.DisplayColoredNpcs(travelerActionChoice);
                    break;

                case PlayerAction.LookAt:
                    LookAtAction();
                    _gameConsoleView.DisplayColoredObjects(travelerActionChoice, _gamePirate.IndividualGameObject);
                    break;

                case PlayerAction.Travel:

                    //
                    // get new location choice and update current location
                    //
                    _gamePirate.IslandLocationId = _gameConsoleView.DisplayGetNextIslandLocation();
                    _currentLocation             = _gameUniverse.GetIslandLocationById(_gamePirate.IslandLocationId);

                    //
                    // display game play screen with current location info and coordiantes
                    //
                    _gameConsoleView.DisplayGamePlayScreen("Current Location", Text.CurrentLocationInfo(_currentLocation), ActionMenu.MainMenu, "");
                    _gameConsoleView.DisplayColoredText("", PlayerAction.ReturnToMainMenu, _currentLocation);
                    break;

                case PlayerAction.PirateLocationsVisited:
                    _gameConsoleView.DisplayLocationsVisited();
                    _gameConsoleView.DisplayColoredText("", travelerActionChoice, _currentLocation);
                    break;

                case PlayerAction.AdminMenu:
                    ActionMenu.currentMenu = ActionMenu.CurrentMenu.AdminMenu;

                    _gameConsoleView.DisplayGamePlayScreen("Admin Menu", "Select an operation from the menu.", ActionMenu.AdminMenu, "");;
                    break;

                case PlayerAction.ReturnToMainMenu:
                    ActionMenu.currentMenu = ActionMenu.CurrentMenu.MainMenu;

                    _gameConsoleView.DisplayGamePlayScreen("Current Location", Text.CurrentLocationInfo(_currentLocation), ActionMenu.MainMenu, "");
                    _gameConsoleView.DisplayColoredText("", travelerActionChoice, _currentLocation);
                    break;

                case PlayerAction.Inventory:
                    _gameConsoleView.DisplayInventory();
                    break;

                case PlayerAction.TreasureInventory:
                    _gameConsoleView.DisplayTreasureInventory();
                    _gameConsoleView.DisplayColoredObjects(travelerActionChoice, 0);
                    break;

                case PlayerAction.PickUp:
                    PickUpAction();
                    break;

                case PlayerAction.PutDown:
                    PutDownAction();
                    break;

                case PlayerAction.TalkTo:
                    TalkToAction();
                    break;

                case PlayerAction.TradeWith:
                    TradeWithAction();
                    break;

                case PlayerAction.Exit:
                    _gameConsoleView.DisplayClosingScreen();
                    _playingGame = false;
                    break;

                default:
                    break;
                }
            }

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