示例#1
0
        private void TravelAction()
        {
            GameObject keyObject = _gameUniverse.GetGameObjectById(10);

            //
            // Looks for the key object in the traveler's inventory. If found set all locations accesbility to true
            //
            if (_gameTraveler.Inventory.Contains(keyObject))
            {
                foreach (SpaceTimeLocation location in _gameUniverse.SpaceTimeLocations)
                {
                    location.Accessible = true;
                }
            }

            //
            // get new location choice and update the current location property
            //
            _gameTraveler.SpaceTimeLocationID = _gameConsoleView.DisplayGetNextSpaceTimeLocation();
            _currentLocation = _gameUniverse.GetSpaceTimeLocationById(_gameTraveler.SpaceTimeLocationID);

            //
            // display the new space-time location info
            //
            _gameConsoleView.DisplayCurrentLocationInfo();
        }
        /// <summary>
        /// process the Travel action
        /// </summary>
        private void TravelAction()
        {
            //
            // get new location choice and update the current location property
            //
            _gameTraveler.SpaceTimeLocationID = _gameConsoleView.DisplayGetNextSpaceTimeLocation();
            _currentLocation = _gameUniverse.GetSpaceTimeLocationById(_gameTraveler.SpaceTimeLocationID);

            //
            // display the new space-time location info
            //
            _gameConsoleView.DisplayCurrentLocationInfo();
        }
示例#3
0
        /// <summary>
        /// method to manage the application setup and game loop
        /// </summary>
        private void ManageGameLoop()
        {
            TravelerAction travelerActionChoice = TravelerAction.None;

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

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

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

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

            //
            // prepare game play screen
            //
            _currentLocation = _gameUniverse.GetSpaceTimeLocationById(_gameTraveler.SpaceTimeLocationID);
            _gameConsoleView.DisplayGamePlayScreen("Current Location", Text.CurrentLocationInfo(_currentLocation), ActionMenu.MainMenu, "");

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

                //
                // get next game action from player
                //
                travelerActionChoice = _gameConsoleView.GetActionMenuChoice(ActionMenu.MainMenu);

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

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

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

                case TravelerAction.Travel:
                    //
                    // get new location choice and update the current location property
                    //
                    _gameTraveler.SpaceTimeLocationID = _gameConsoleView.DisplayGetNextSpaceTimeLocation();
                    _currentLocation = _gameUniverse.GetSpaceTimeLocationById(_gameTraveler.SpaceTimeLocationID);

                    //
                    // display the new space-time location info
                    //
                    _gameConsoleView.DisplayCurrentLocationInfo();
                    break;

                case TravelerAction.TravelerLocationsVisited:
                    _gameConsoleView.DisplayLocationsVisited();
                    break;

                case TravelerAction.ListSpaceTimeLocations:
                    _gameConsoleView.DisplayListOfSpaceTimeLocations();
                    break;

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

                case TravelerAction.Exit:
                    _playingGame = false;
                    break;

                default:
                    break;
                }
            }

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