Example #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)
            {
                //
                // 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.Travel:
                    _gameTraveler.SpaceTimeLocationID = _gameConsoleView.DisplayGetTravelersNewDestination().SpaceTimeLocationID;
                    break;

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

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

                case TravelerAction.Exit:
                    _usingGame = false;
                    break;

                default:
                    break;
                }
            }

            _gameConsoleView.DisplayExitPrompt();

            //
            // close the application
            //
            Environment.Exit(1);
        }
Example #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)
            {
                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);
        }
        /// <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);
        }