Exemple #1
0
        /// <summary>
        /// get a location object using an Id
        /// </summary>
        /// <param name="Id">location ID</param>
        /// <returns>requested location</returns>
        public SpaceTimeLocation GetSpaceTimeLocationById(int Id)
        {
            SpaceTimeLocation spaceTimeLocation = null;

            //
            // run through the location list and grab the correct one
            //
            foreach (SpaceTimeLocation location in _spaceTimeLocations)
            {
                if (location.SpaceTimeLocationID == Id)
                {
                    spaceTimeLocation = location;
                }
            }

            //
            // the specified ID was not found in the universe
            // throw and exception
            //
            if (spaceTimeLocation == null)
            {
                string feedbackMessage = $"The Location ID {Id} does not exist in the current Universe.";
            }

            return(spaceTimeLocation);
        }
Exemple #2
0
        /// <summary>
        /// display current location information
        /// </summary>
        /// <param name="spaceTimeLocation"></param>
        /// <returns></returns>
        public static string CurrentLocationInfo(SpaceTimeLocation spaceTimeLocation)
        {
            string messageBoxText =
                $"Current Location: {spaceTimeLocation.CommonName}\n" +
                " \n" +
                spaceTimeLocation.Description;

            return(messageBoxText);
        }
Exemple #3
0
        ///<summary>
        /// look around
        /// </summary>
        public static string LookAround(SpaceTimeLocation spaceTimeLocation)
        {
            string messageBoxText =
                $"Current Location: {spaceTimeLocation.CommonName}\n" +
                " \n" +
                spaceTimeLocation.GeneralContents;

            return(messageBoxText);
        }
Exemple #4
0
        /// <summary>
        /// determine if a location is accessible to the player
        /// </summary>
        /// <param name="spaceTimeLocationId"></param>
        /// <returns>accessible</returns>
        public bool IsAccessibleLocation(int spaceTimeLocationId)
        {
            SpaceTimeLocation spaceTimeLocation = GetSpaceTimeLocationById(spaceTimeLocationId);

            if (spaceTimeLocation.Accessible == true)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #5
0
        ///<summary>
        /// display look around
        /// </summary>
        public void DisplayLookAround()
        {
            //
            // get current location
            //
            SpaceTimeLocation currentSpaceTimeLocation = _gameUniverse.GetSpaceTimeLocationById(_gamePlayer.SpaceTimeLocationID);

            //
            // get list of game objects in current location
            //
            List <GameObject> gameObjectsInCurrentSpaceTimeLocation = _gameUniverse.GetGameObjectByLocationId(_gamePlayer.SpaceTimeLocationID);

            //
            // get list of NPCs in current location
            //
            List <Npc> npcsInCurrentSpactTimeLocation = _gameUniverse.GetNpcsByLocationId(_gamePlayer.SpaceTimeLocationID);

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

            messageBoxText += Text.GameObjectsChooseList(gameObjectsInCurrentSpaceTimeLocation);
            messageBoxText += Text.NpcsChooseList(npcsInCurrentSpactTimeLocation);

            DisplayGamePlayScreen("Current Location", Text.LookAround(currentSpaceTimeLocation), ActionMenu.MainMenu, "");
        }
        /// <summary>
        /// method to manage the application setup and game loop
        /// </summary>
        private void ManageGameLoop()
        {
            PlayerAction playerActionChoice = PlayerAction.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 player
            //
            InitializeMission();

            //
            // prepare game play screen
            //
            _currentLocation = _gameUniverse.GetSpaceTimeLocationById(_gamePlayer.SpaceTimeLocationID);
            _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
                //
                playerActionChoice = GetNextPlayerAction();

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

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

                case PlayerAction.ListLocations:
                    _gameConsoleView.DisplayListOfLocations();
                    break;

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

                case PlayerAction.LookAt:
                    LookAtAction();
                    break;

                case PlayerAction.Travel:
                    //
                    // get new location choice and update the current location property
                    //
                    _gamePlayer.SpaceTimeLocationID = _gameConsoleView.DisplayGetNextLocation();
                    _currentLocation = _gameUniverse.GetSpaceTimeLocationById(_gamePlayer.SpaceTimeLocationID);

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

                case PlayerAction.PickUp:
                    PickUpAction();
                    break;

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

                case PlayerAction.LocationsVisited:
                    _gameConsoleView.DisplayLocationsVisited();
                    break;

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

                case PlayerAction.PutDown:
                    PutDownAction();
                    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, "");
                    break;

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

                case PlayerAction.PlayerMenu:
                    ActionMenu.currentMenu = ActionMenu.CurrentMenu.PlayerMenu;
                    _gameConsoleView.DisplayGamePlayScreen("Traveler 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.NonplayerCharacterMenu:
                    ActionMenu.currentMenu = ActionMenu.CurrentMenu.NpcMenu;
                    _gameConsoleView.DisplayGamePlayScreen("NPC Menu", "Select an operation from the menu.", ActionMenu.NpcMenu, "");
                    break;

                case PlayerAction.TalkTo:
                    TalkToAction();
                    break;

                case PlayerAction.Exit:
                    _playingGame = false;
                    break;

                default:
                    break;
                }
            }

            //
            // close the application
            //
            Environment.Exit(1);
        }
Exemple #7
0
        /// <summary>
        /// show the current location info
        /// </summary>
        public void DisplayCurrentLocationInfo()
        {
            SpaceTimeLocation currentSpaceTimeLocation = _gameUniverse.GetSpaceTimeLocationById(_gamePlayer.SpaceTimeLocationID);

            DisplayGamePlayScreen("Current Location", Text.CurrentLocationInfo(currentSpaceTimeLocation), ActionMenu.MainMenu, "");
        }