Beispiel #1
0
        public static string CurrentLocationInfo(WorldLocations worldLocation)
        {
            string messageBoxText =
                $"You are currently in {worldLocation.Name}\n" +
                "\n" + worldLocation.Description;

            return(messageBoxText);
        }
Beispiel #2
0
        public static string LookAround(WorldLocations worldLocation)
        {
            string messageBox = $"You are currently in {worldLocation.Name}\n" +
                                $"\n";

            //add room contents later when we get into world objects
            return(messageBox);
        }
Beispiel #3
0
        public bool IsLockedLocation(int locationId)
        {
            WorldLocations worldLocation = GetLocationById(locationId);

            if (worldLocation.Locked == true)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #4
0
        public void DisplayLookAround()
        {
            //get current location
            WorldLocations currentLocation = _worldContents.GetLocationById(_gameSurvivor.LocationId);


            //get list of game objects in current location
            List <GameObject> gameObjectsInCurrentLocation = _worldContents.GetGameObjectsByLocationId(_gameSurvivor.LocationId);

            //get list of NPCs in current location
            List <Npc> npcsInCurrentLocation = _worldContents.GetNpcsByLocationId(_gameSurvivor.LocationId);

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

            messageBoxText += Text.GameObjectsChooseList(gameObjectsInCurrentLocation) + Environment.NewLine;
            messageBoxText += Text.NpcsChooseList(npcsInCurrentLocation);

            DisplayGamePlayScreen("Current Location", messageBoxText, ActionMenu.MainMenu, "");
        }
Beispiel #5
0
        public WorldLocations GetLocationById(int Id)
        {
            WorldLocations worldLocation = null;

            //run through world location list and grab correct one
            foreach (WorldLocations location in _worldLocations)
            {
                if (location.LocationID == Id)
                {
                    worldLocation = location;
                }
            }

            //if specified id is not in list of locations
            if (worldLocation == null)
            {
                string feedbackMessage = $"This area doesn't exist here.";
                throw new ArgumentException(Id.ToString(), feedbackMessage);
            }

            return(worldLocation);
        }
Beispiel #6
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("Intro", Text.MissionIntro(), ActionMenu.MissionIntro, "");
            _gameConsoleView.GetContinueKey();

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

            //
            // prepare game play screen
            //
            _gameConsoleView.DisplayGamePlayScreen("Current Location", Text.CurrrentLocationInfo(), ActionMenu.MainMenu, "");
            _currentLocation = _worldContents.GetLocationById(_gameSurvivor.LocationId);


            //
            // game loop
            //
            while (_playingGame)
            {
                UpdateGameStatus();
                // _gameConsoleView.DisplayStatusBox();

                //get next action choice
                survivorActionChoice = GetNextSurvivorAction();

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

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

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

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

                case SurvivorAction.Travel:
                    //get new location choice and update current location
                    _gameSurvivor.LocationId = _gameConsoleView.GetNextLocation();
                    _currentLocation         = _worldContents.GetLocationById(_gameSurvivor.LocationId);

                    //set gameplayscreen as current location info
                    _gameConsoleView.DisplayGamePlayScreen("Current Location", Text.CurrentLocationInfo(_currentLocation),
                                                           ActionMenu.MainMenu, "");
                    break;

                case SurvivorAction.SurvivorLocationsVisited:
                    _gameConsoleView.DisplayLocationsVisisted();
                    //_gameConsoleView.DisplayStatusBox();
                    break;

                case SurvivorAction.ListGameObjects:
                    _gameConsoleView.DisplayListOfGameObjects();
                    // _gameConsoleView.DisplayStatusBox();
                    break;

                case SurvivorAction.DisplayNonPlayableCharacters:
                    _gameConsoleView.DisplayListOfNpcObjects();
                    break;

                case SurvivorAction.LookAt:
                    LookAtAction();
                    break;

                case SurvivorAction.PickUp:
                    PickUpAction();
                    break;

                case SurvivorAction.PutDown:
                    PutDownAction();
                    break;

                case SurvivorAction.TalkTo:
                    TalkToAction();
                    break;

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

                case SurvivorAction.AdminMenu:
                    ActionMenu.currentMenu = ActionMenu.CurrentMenu.AdminMenu;
                    _gameConsoleView.DisplayGamePlayScreen("Admin Menu", "Select an option 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.ObjectMenu:
                    ActionMenu.currentMenu = ActionMenu.CurrentMenu.ObjectMenu;
                    _gameConsoleView.DisplayGamePlayScreen("Object Menu", "Select an action from the menu.",
                                                           ActionMenu.ObjectMenu, "");
                    break;

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

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

                case SurvivorAction.Exit:
                    _playingGame = false;
                    break;



                default:
                    break;
                }
            }

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