Beispiel #1
0
        /// <summary>
        /// method to manage the application setup and control loop
        /// </summary>
        private void ManageGameLoop()
        {
            TravelerAction travelerActionChoice;

            _gameConsoleView.DisplayWelcomeScreen();

            InitializeMission();

            //
            // game loop
            //
            while (_usingGame)
            {
                int itemID;
                int treasureID;

                //
                // get a menu choice from the ConsoleView object
                //
                travelerActionChoice = _gameConsoleView.DisplayGetTravelerActionChoice();

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

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

                case TravelerAction.LookAt:
                    _gameConsoleView.DisplayLookAt();
                    break;

                case TravelerAction.TalkTo:
                    _gameConsoleView.DisplayTalkTo();
                    break;

                case TravelerAction.PickUpItem:
                    itemID = _gameConsoleView.DisplayPickUpItem();

                    Item itemToPickup = _gameUniverse.GetItemtByID(itemID);

                    itemToPickup.SpaceTimeLocationID = 0;
                    _gameTraveler.TravelersItems.Add(itemToPickup);
                    break;

                case TravelerAction.PickUpTreasure:
                    treasureID = _gameConsoleView.DisplayPickUpTreasure();

                    Treasure treasureToPickup = _gameUniverse.GetTreasureByID(treasureID);

                    treasureToPickup.SpaceTimeLocationID = 0;
                    _gameTraveler.TravelersTreasures.Add(treasureToPickup);
                    break;
                    break;

                case TravelerAction.PutDownItem:
                    itemID = _gameConsoleView.DisplayPutDownItem();

                    Item itemToPutDown = _gameUniverse.GetItemtByID(itemID);

                    itemToPutDown.SpaceTimeLocationID = _gameTraveler.SpaceTimeLocationID;
                    _gameTraveler.TravelersItems.Remove(itemToPutDown);
                    break;

                case TravelerAction.PutDownTreasure:
                    treasureID = _gameConsoleView.DisplayPutDownTreasure();

                    Treasure treasureToPutDown = _gameUniverse.GetTreasureByID(treasureID);

                    treasureToPutDown.SpaceTimeLocationID = _gameTraveler.SpaceTimeLocationID;
                    _gameTraveler.TravelersTreasures.Remove(treasureToPutDown);
                    break;

                case TravelerAction.Travel:
                    _gameTraveler.SpaceTimeLocationID = _gameConsoleView.DisplayGetTravelersNewDestination().SpaceTimeLocationID;
                    break;

                case TravelerAction.TravelerInfo:
                    _gameConsoleView.DisplayTravelerInfo();
                    break;

                case TravelerAction.TravelerInventory:
                    _gameConsoleView.DisplayTravelerItems();
                    break;

                case TravelerAction.TravelerTreasure:
                    _gameConsoleView.DisplayTravelerTreasure();
                    break;

                case TravelerAction.ListTARDISDestinations:
                    _gameConsoleView.DisplayListAllTARDISDestinations();
                    break;

                case TravelerAction.ListItems:
                    _gameConsoleView.DisplayListAllGameItems();
                    break;

                case TravelerAction.ListTreasures:
                    _gameConsoleView.DisplayListAllGameTreasures();
                    break;

                case TravelerAction.Exit:
                    _usingGame = false;
                    break;

                default:
                    break;
                }
            }

            _gameConsoleView.DisplayExitPrompt();

            //
            // close the application
            //
            Environment.Exit(1);
        }
Beispiel #2
0
        /// <summary>
        /// method to manage the application setup and control loop
        /// </summary>
        private void ManageGameLoop()
        {
            TravelerAction travelerActionChoice;

            _gameConsoleView.DisplayWelcomeScreen();

            InitializeMission();

            //
            // game loop
            //
            while (_usingGame)
            {
                //
                // get a menu choice from the ConsoleView object
                //
                travelerActionChoice = _gameConsoleView.DisplayGetTravelerActionChoice();

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

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

                case TravelerAction.LookAt:

                    break;

                case TravelerAction.PickUpItem:

                    break;

                case TravelerAction.PickUpTreasure:

                    break;

                case TravelerAction.PutDownItem:

                    break;

                case TravelerAction.PutDownTreasure:

                    break;

                case TravelerAction.Travel:
                    _gameTraveler.SpaceTimeLocationID = _gameConsoleView.DisplayGetTravelersNewDestination().SpaceTimeLocationID;
                    break;

                case TravelerAction.TravelerInfo:
                    _gameConsoleView.DisplayTravelerInfo();
                    break;

                case TravelerAction.TravelerInventory:
                    _gameConsoleView.DisplayTravelerItems();
                    break;

                case TravelerAction.TravelerTreasure:
                    _gameConsoleView.DisplayTravelerTreasure();
                    break;

                case TravelerAction.ListTARDISDestinations:
                    _gameConsoleView.DisplayListAllTARDISDestinations();
                    break;

                case TravelerAction.ListItems:
                    _gameConsoleView.DisplayListAllGameItems();
                    break;

                case TravelerAction.ListTreasures:
                    _gameConsoleView.DisplayListAllGameTreasures();
                    break;

                case TravelerAction.Exit:
                    _usingGame = false;
                    break;

                default:
                    break;
                }
            }

            _gameConsoleView.DisplayExitPrompt();

            //
            // close the application
            //
            Environment.Exit(1);
        }
        /// <summary>
        /// method to manage the application setup and control loop
        /// </summary>
        private void ManageGameLoop()
        {
            TravelerAction travelerActionChoice;

            _gameConsoleView.DisplayWelcomeScreen();

            InitializeMission();

            //
            // game loop
            //
            while (_usingGame)
            {
                //
                // get a menu choice from the ConsoleView object
                //
                travelerActionChoice = _gameConsoleView.DisplayGetTravelerActionChoice();

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

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

                case TravelerAction.LookAt:
                    //
                    // TODO write a DisplayLookAt method that lists game object name and details in the location
                    //
                    _gameConsoleView.DisplayLookAt();
                    break;

                case TravelerAction.PickUpItem:
                    //
                    // TODO write a DisplayPickUpItem method in the ConsoleView that lists game objects in a location and prompts the traveler for an ID that is returned. Then adds the object to the traveler's inventory by adding them to the traveler's item list and setting the object's LocationID to 0.
                    //
                    int itemID;
                    itemID = _gameConsoleView.DisplayPickUpItem();

                    Item PickedUpItem = new Item();
                    PickedUpItem = _gameUniverse.GetItemtByID(itemID);

                    _gameTraveler.TravelersItems.Add(PickedUpItem);

                    PickedUpItem.SpaceTimeLocationID = 0;

                    break;

                case TravelerAction.PickUpTreasure:
                    //
                    // TODO write a DisplayPickUpTreasure method in the ConsoleView that lists game treasures in a location and prompts the traveler for an ID that is returned. Then adds the object to the player's treasure by adding them to the traveler's treasure list and setting the object's LocationID to the location of the traveler.
                    //
                    break;

                case TravelerAction.PutDownItem:
                    //
                    // TODO write a DisplayPutDownItem method in the ConsoleView that lists the travelers game items and prompts the traveler for an ID that is returned. Then removes the object from the travel's items by removing it from the traveler's item list and setting the items's LocationID to the location of the traveler.
                    //
                    break;

                case TravelerAction.PutDownTreasure:
                    //
                    // TODO write a DisplayPutDownTreasure method in the ConsoleView that lists the travelers game treasures and prompts the player for an ID that is returned. Then removes the object from the travel's treasure by removing it from the traveler's treasure list and setting the treasures's LocationID to the location of the traveler.
                    //
                    break;

                case TravelerAction.Travel:
                    _gameTraveler.SpaceTimeLocationID = _gameConsoleView.DisplayGetTravelersNewDestination().SpaceTimeLocationID;
                    break;

                case TravelerAction.TravelerInfo:
                    _gameConsoleView.DisplayTravelerInfo();
                    break;

                case TravelerAction.TravelerInventory:
                    _gameConsoleView.DisplayTravelerItems();
                    break;

                case TravelerAction.TravelerTreasure:
                    _gameConsoleView.DisplayTravelerTreasure();
                    break;

                case TravelerAction.ListTARDISDestinations:
                    _gameConsoleView.DisplayListAllTARDISDestinations();
                    break;

                case TravelerAction.ListItems:
                    _gameConsoleView.DisplayListAllGameItems();
                    break;

                case TravelerAction.ListTreasures:
                    _gameConsoleView.DisplayListAllGameTreasures();
                    break;

                case TravelerAction.Exit:
                    _usingGame = false;
                    break;

                default:
                    break;
                }
            }

            _gameConsoleView.DisplayExitPrompt();

            //
            // close the application
            //
            Environment.Exit(1);
        }
        /// <summary>
        /// method to manage the application setup and control loop
        /// </summary>
        private void ManageGameLoop()
        {
            PlayerAction travelerActionChoice;

            _gameConsoleView.DisplayWelcomeScreen();

            InitializeMission();

            //
            // game loop
            //
            while (_usingGame)
            {
                int health = _gamePlayer.Health;

                // get a menu choice from the ConsoleView object
                //
                travelerActionChoice = _gameConsoleView.DisplayGetPlayerActionChoice();
                if (health <= 0)
                {
                    ConsoleUtil.DisplayReset();
                    Console.WriteLine();
                    ConsoleUtil.DisplayMessage("The last goblin attack was too much for your level of health.");
                    ConsoleUtil.DisplayMessage("Game Over");
                    _gameConsoleView.DisplayContinuePrompt();
                    break;
                }
                //
                // choose an action based on the user's menu choice
                //
                switch (travelerActionChoice)
                {
                case PlayerAction.NONE:
                    break;

                case PlayerAction.BuyItem:
                    _gameConsoleView.BuyItem();
                    break;

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

                case PlayerAction.LookAtItem:
                    _gameConsoleView.DisplayLookAtItems();
                    break;

                case PlayerAction.LookAtTreasure:
                    _gameConsoleView.DisplayLookAtTreasure();
                    break;

                case PlayerAction.PickUpItem:
                    _gameConsoleView.DisplayPickUpItem();
                    break;

                case PlayerAction.PickUpTreasure:
                    _gameConsoleView.DisplayPickUpTreasure();
                    break;

                case PlayerAction.PutDownItem:
                    _gameConsoleView.DisplayPutDownItem();
                    break;

                case PlayerAction.PutDownTreasure:
                    _gameConsoleView.DisplayPutDownTreasure();
                    break;

                case PlayerAction.Travel:
                    _gamePlayer.RoomID = _gameConsoleView.DisplayGetPlayersNewDestination().RoomID;
                    break;

                case PlayerAction.SpeakToNPC:
                    _gameConsoleView.DisplaySpeakToNPC();
                    break;

                case PlayerAction.PlayerInfo:
                    _gameConsoleView.DisplayTravelerInfo();
                    break;

                case PlayerAction.PlayerItems:
                    _gameConsoleView.DisplayPlayerItemInventory();
                    break;

                case PlayerAction.PlayerTreasure:
                    _gameConsoleView.DisplayPlayerTreasureInventory();
                    break;

                case PlayerAction.ListCastleRooms:
                    _gameConsoleView.DisplayListAllCastleRooms();
                    break;

                case PlayerAction.ListItems:
                    _gameConsoleView.DisplayListAllGameItems();
                    break;

                case PlayerAction.ListTreasures:
                    _gameConsoleView.DisplayListAllGameTreasures();
                    break;

                case PlayerAction.Exit:
                    _usingGame = false;
                    break;

                default:
                    break;
                }
            }

            _gameConsoleView.DisplayExitPrompt();

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