Exemplo n.º 1
0
        /// <summary>
        /// get a SpaceTimeLocation object using an Id
        /// </summary>
        /// <param name="Id">space-time location ID</param>
        /// <returns>requested space-time location</returns>
        public IslandLocation GetIslandLocationById(int Id)
        {
            IslandLocation islandLocation = null;

            //
            // run through the island location list and grab the correct one
            //
            foreach (IslandLocation location in _islandLocations)
            {
                if (location.IslandLocationID == Id)
                {
                    islandLocation = location;
                }
            }

            //
            // the specified ID was not found in the universe
            // throw an exception
            //
            if (islandLocation == null)
            {
                string feedbackMessage = $"The Island Location ID {Id} does not exist in the current Universe.";
                throw new ArgumentException(Id.ToString(), feedbackMessage);
            }

            return(islandLocation);
        }
Exemplo n.º 2
0
        /// <summary>
        /// gets an island location ID choosen from the user
        /// </summary>
        public IslandLocation GetIslandLocationById(int id)
        {
            IslandLocation islandLocation = null;

            //
            // shift through islandLocation list and select correct one
            //
            foreach (IslandLocation location in _islandLocations)
            {
                if (location.IslandLocationID == id)
                {
                    islandLocation = location;
                }
            }

            //
            // if the ID is not found wihtin the universe,
            // throw an exception
            //
            if (islandLocation == null)
            {
                string feedbackMessage = $"The Island Location ID, {id}, does not exist on the current Map.";
                throw new ArgumentException(id.ToString(), feedbackMessage);
            }

            return(islandLocation);
        }
Exemplo n.º 3
0
        public static string CurrentLocationInfo(IslandLocation islandLocation)
        {
            string messageBoxText =
                $"Current Location: {islandLocation.CommonName}\n" +
                "\n" +
                islandLocation.Description;

            return(messageBoxText);
        }
Exemplo n.º 4
0
        public static string LookAround(IslandLocation islandLocation)
        {
            string messageBoxText =
                $"Current Location: {islandLocation.CommonName}\n" +
                "\n" +
                islandLocation.GeneralContents;

            return(messageBoxText);
        }
Exemplo n.º 5
0
        private void UnlockLocation(CrewMember civilian)
        {
            int keys = civilian.Keys;

            if (keys != 0)
            {
                IslandLocation unlockedLocation = _gameUniverse.GetIslandLocationById(keys);
                unlockedLocation.Accessible = true;
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// allows user to "look around" their current location, and
        /// displays location's general contents
        /// </summary>
        public static string LookAround(IslandLocation islandLocation)
        {
            string messageBox =
                $"Current Location: \n" +
                "Coordinates: \n" +
                " \n" +

                islandLocation.GeneralContents;

            return(messageBox);
        }
Exemplo n.º 7
0
        /// <summary>
        /// displays current location info
        /// </summary>
        public static string CurrentLocationInfo(IslandLocation islandLocation)
        {
            string messageBox =
                "Current Location: \n" +
                "Coordinates: \n" +
                " \n" +
                " \n" +

                islandLocation.Description;

            return(messageBox);
        }
Exemplo n.º 8
0
        /// <summary>
        /// determines if the choosen island location is accessible or not
        /// </summary>
        public bool IsAccessibleLocation(int islandLocationId)
        {
            IslandLocation islandLocation = GetIslandLocationById(islandLocationId);

            if (islandLocation.Accessible == true)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 9
0
        /// <summary>
        /// displays current location info
        /// </summary>
        public static string CurrentLocationInfo(IslandLocation islandLocation)
        {
            string messageBox =
                "Current Location: \n" +
                "Coordinates: \n" +
                " \n" +
                " \n" +

                islandLocation.Description +

                " \n" +
                " \n" +
                "\tChoose from the menu options to proceed.\n";

            return(messageBox);
        }
Exemplo n.º 10
0
        public void DisplayLookAround()
        {
            //
            // get current island location
            //
            IslandLocation currentIslandLocation = _gameUniverse.GetIslandLocationById(_gameSurvivor.IslandLocationID);

            //
            // get list of game objects in current space-time location
            //
            List <GameObject> gameObjectsInCurrentIslandLocation = _gameUniverse.GetGameObjectsByIslandLocationId(_gameSurvivor.IslandLocationID);

            //
            // get list of NPCs in current space-time location
            //
            List <Npc> npcsInCurrentIslandLocation = _gameUniverse.GetNpcsBySpaceTimeLocationId(_gameSurvivor.IslandLocationID);

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

            messageBoxText += Text.GameObjectsChooseList(gameObjectsInCurrentIslandLocation);
            messageBoxText += Text.NpcsChooseList(npcsInCurrentIslandLocation);

            DisplayGamePlayScreen("Current Location", messageBoxText, ActionMenu.MainMenu, "");
        }
        /// <summary>
        /// method to manage the application setup and game loop
        /// </summary>
        private void ManageGameLoop()
        {
            PlayerAction travelerActionChoice = PlayerAction.None;

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

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

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

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

            //
            // prepare game play screen
            //
            _currentLocation = _gameUniverse.GetIslandLocationById(_gamePirate.IslandLocationId);
            _gameConsoleView.DisplayGamePlayScreen("Current Location", Text.CurrentLocationInfo(_currentLocation), ActionMenu.MainMenu, "");
            _gameConsoleView.DisplayColoredText("", PlayerAction.ReturnToMainMenu, _currentLocation);

            //
            // game loop
            //
            while (_playingGame)
            {
                Console.CursorVisible = false;


                //
                // update all game stats/info
                //
                UpdateGameStatus();

                //
                // get game action from player
                //
                if (ActionMenu.currentMenu == ActionMenu.CurrentMenu.MainMenu)
                {
                    travelerActionChoice = _gameConsoleView.GetActionMenuChoice(ActionMenu.MainMenu);
                }
                else if (ActionMenu.currentMenu == ActionMenu.CurrentMenu.AdminMenu)
                {
                    travelerActionChoice = _gameConsoleView.GetActionMenuChoice(ActionMenu.AdminMenu);
                }

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

                case PlayerAction.EditPlayerInfo:
                    _gameConsoleView.DisplayEditPirateInformation();

                    //
                    // display game play screen with current location info and coordiantes
                    //
                    _gameConsoleView.DisplayGamePlayScreen("Current Location", Text.CurrentLocationInfo(_currentLocation), ActionMenu.MainMenu, "");
                    _gameConsoleView.DisplayColoredText("", PlayerAction.LookAround, _currentLocation);
                    break;

                case PlayerAction.PlayerInfo:
                    _gameConsoleView.DisplayPirateInfo();
                    _gameConsoleView.DisplayColoredText("", travelerActionChoice, _currentLocation);
                    break;

                case PlayerAction.ListDestinations:
                    _gameConsoleView.DisplayListOfIslandLocations();
                    _gameConsoleView.DisplayColoredText("", travelerActionChoice, _currentLocation);
                    break;

                case PlayerAction.ListGameObjects:
                    _gameConsoleView.DisplayListOfAllGameObjects();
                    _gameConsoleView.DisplayColoredText("", travelerActionChoice, _currentLocation);
                    break;

                case PlayerAction.LookAround:
                    _gameConsoleView.DisplayLookAround();
                    _gameConsoleView.DisplayColoredText("", travelerActionChoice, _currentLocation);
                    break;

                case PlayerAction.LookAt:
                    LookAtAction();
                    break;

                case PlayerAction.Travel:
                    //
                    // determine if the player has a ship in order to travel
                    //
                    if (_gamePirate.Ship == Ship.ShipType.None)
                    {
                        _gamePirate.ShipOwner = false;
                        _gameConsoleView.DisplayInputErrorMessage("You currently do not own a ship needed to travel. Obtain a ship, and try again.");
                        break;
                    }
                    else
                    {
                        _gamePirate.ShipOwner = true;
                    }

                    //
                    // get new location choice and update current location
                    //
                    _gamePirate.IslandLocationId = _gameConsoleView.DisplayGetNextIslandLocation();
                    _currentLocation             = _gameUniverse.GetIslandLocationById(_gamePirate.IslandLocationId);

                    //
                    // display game play screen with current location info and coordiantes
                    //
                    _gameConsoleView.DisplayGamePlayScreen("Current Location", Text.CurrentLocationInfo(_currentLocation), ActionMenu.MainMenu, "");
                    _gameConsoleView.DisplayColoredText("", PlayerAction.ReturnToMainMenu, _currentLocation);
                    break;

                case PlayerAction.PirateLocationsVisited:
                    _gameConsoleView.DisplayLocationsVisited();
                    _gameConsoleView.DisplayColoredText("", travelerActionChoice, _currentLocation);
                    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, "");
                    _gameConsoleView.DisplayColoredText("", travelerActionChoice, _currentLocation);
                    break;

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

                case PlayerAction.TreasureInventory:
                    _gameConsoleView.DisplayTreasureInventory();
                    break;

                case PlayerAction.PickUp:
                    PickUpAction();
                    break;

                case PlayerAction.PutDown:
                    PutDownAction();
                    break;

                case PlayerAction.Exit:
                    _gameConsoleView.DisplayClosingScreen();
                    _playingGame = false;
                    break;

                default:
                    break;
                }
            }

            //
            // close the application
            //
            Environment.Exit(1);
        }
Exemplo n.º 12
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("Quest Intro", Text.QuestIntro(), ActionMenu.QuestIntro, "");
            _gameConsoleView.GetContinueKey();

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

            //
            // prepare game play screen
            //
            _currentLocation = _gameUniverse.GetIslandLocationById(_gameSurvivor.IslandLocationID);
            _gameConsoleView.DisplayGamePlayScreen("Current Location", Text.CurrentLocationInfo(_gameUniverse.GetIslandLocationById(_gameSurvivor.IslandLocationID)), ActionMenu.MainMenu, "");

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

                //
                // get next game action from player
                //
                survivorActionChoice = GetNextTravelerAction();

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

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

                case SurvivorAction.SurvivorEditInfo:
                    _gameConsoleView.EditSurvivorInfo(_gameSurvivor);
                    break;

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

                case SurvivorAction.LookAt:
                    LookAtAction();
                    break;

                case SurvivorAction.PickUp:
                    PickUpAction();
                    break;

                case SurvivorAction.PutDown:
                    PutDownAction();
                    break;

                case SurvivorAction.InteractWith:
                    InteractWithAction();
                    break;

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

                case SurvivorAction.Travel:
                    //
                    // get new location choice and update the current location property
                    //
                    _gameSurvivor.IslandLocationID = _gameConsoleView.DisplayGetNextIslandLocation();
                    _currentLocation = _gameUniverse.GetIslandLocationById(_gameSurvivor.IslandLocationID);

                    //
                    // set the game play screen to the current location info format
                    //
                    _gameConsoleView.DisplayGamePlayScreen("Current Location", Text.CurrentLocationInfo(_currentLocation), ActionMenu.MainMenu, "");

                    UpdateGameStatus(_playingGame);
                    break;

                case SurvivorAction.SurvivorLocationsVisited:
                    _gameConsoleView.DisplayLocationsVisited();
                    break;

                case SurvivorAction.ListIslandLocations:
                    _gameConsoleView.DisplayListOfIslandLocations();
                    break;

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

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

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

                case SurvivorAction.ObjectMenu:
                    ActionMenu.currentMenu = ActionMenu.CurrentMenu.ObjectMenu;
                    _gameConsoleView.DisplayGamePlayScreen("Object Menu", "Select an operation from the menu.", ActionMenu.ObjectMenu, "");
                    break;

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

                case SurvivorAction.TalkTo:
                    TalkToAction();
                    break;

                case SurvivorAction.AskToScavenge:
                    AskToScavenge();
                    break;

                case SurvivorAction.AdminMenu:
                    ActionMenu.currentMenu = ActionMenu.CurrentMenu.AdminMenu;
                    _gameConsoleView.DisplayGamePlayScreen("Admin Menu", "Select an operation 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.Exit:
                    _playingGame = false;
                    break;

                default:
                    break;
                }
            }

            //
            // close the application
            //
            Environment.Exit(1);
        }
Exemplo n.º 13
0
        /// <summary>
        /// method to manage the application setup and game loop
        /// </summary>
        private void ManageGameLoop()
        {
            PlayerAction travelerActionChoice = PlayerAction.None;

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

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

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

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

            //
            // prepare game play screen
            //
            _currentLocation = _gameUniverse.GetIslandLocationById(_gamePirate.IslandLocationId);
            _gameConsoleView.DisplayGamePlayScreen("Current Location", Text.CurrentLocationInfo(_currentLocation), ActionMenu.MainMenu, "");
            _gameConsoleView.DisplayColoredText("", PlayerAction.ReturnToMainMenu, _currentLocation);

            //
            // game loop
            //
            while (_playingGame)
            {
                Console.CursorVisible = false;


                //
                // update all game stats/info
                //
                UpdateGameStatus();

                //
                // get game action from player
                //
                travelerActionChoice = GetNextPlayerAction();

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

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

                case PlayerAction.EditPlayerInfo:
                    _gameConsoleView.DisplayEditPirateInformation();

                    //
                    // display game play screen with current location info and coordiantes
                    //
                    _gameConsoleView.DisplayGamePlayScreen("Current Location", Text.CurrentLocationInfo(_currentLocation), ActionMenu.MainMenu, "");
                    _gameConsoleView.DisplayColoredText("", PlayerAction.ReturnToMainMenu, _currentLocation);
                    break;

                case PlayerAction.PlayerInfo:
                    _gameConsoleView.DisplayPirateInfo();
                    _gameConsoleView.DisplayColoredText("", travelerActionChoice, _currentLocation);
                    break;

                case PlayerAction.ListDestinations:
                    _gameConsoleView.DisplayListOfIslandLocations();
                    _gameConsoleView.DisplayColoredText("", travelerActionChoice, _currentLocation);
                    break;

                case PlayerAction.ListGameObjects:
                    _gameConsoleView.DisplayListOfAllGameObjects();
                    _gameConsoleView.DisplayColoredObjects(travelerActionChoice, 0);
                    break;

                case PlayerAction.ListNpcs:
                    _gameConsoleView.DisplayListOfAllNpcs();
                    _gameConsoleView.DisplayColoredNpcs(travelerActionChoice);
                    break;

                case PlayerAction.LookAround:
                    _gameConsoleView.DisplayLookAround();
                    _gameConsoleView.DisplayColoredText("", travelerActionChoice, _currentLocation);
                    _gameConsoleView.DisplayColoredObjects(travelerActionChoice, 0);
                    _gameConsoleView.DisplayColoredNpcs(travelerActionChoice);
                    break;

                case PlayerAction.LookAt:
                    LookAtAction();
                    _gameConsoleView.DisplayColoredObjects(travelerActionChoice, _gamePirate.IndividualGameObject);
                    break;

                case PlayerAction.Travel:

                    //
                    // get new location choice and update current location
                    //
                    _gamePirate.IslandLocationId = _gameConsoleView.DisplayGetNextIslandLocation();
                    _currentLocation             = _gameUniverse.GetIslandLocationById(_gamePirate.IslandLocationId);

                    //
                    // display game play screen with current location info and coordiantes
                    //
                    _gameConsoleView.DisplayGamePlayScreen("Current Location", Text.CurrentLocationInfo(_currentLocation), ActionMenu.MainMenu, "");
                    _gameConsoleView.DisplayColoredText("", PlayerAction.ReturnToMainMenu, _currentLocation);
                    break;

                case PlayerAction.PirateLocationsVisited:
                    _gameConsoleView.DisplayLocationsVisited();
                    _gameConsoleView.DisplayColoredText("", travelerActionChoice, _currentLocation);
                    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, "");
                    _gameConsoleView.DisplayColoredText("", travelerActionChoice, _currentLocation);
                    break;

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

                case PlayerAction.TreasureInventory:
                    _gameConsoleView.DisplayTreasureInventory();
                    _gameConsoleView.DisplayColoredObjects(travelerActionChoice, 0);
                    break;

                case PlayerAction.PickUp:
                    PickUpAction();
                    break;

                case PlayerAction.PutDown:
                    PutDownAction();
                    break;

                case PlayerAction.TalkTo:
                    TalkToAction();
                    break;

                case PlayerAction.TradeWith:
                    TradeWithAction();
                    break;

                case PlayerAction.Exit:
                    _gameConsoleView.DisplayClosingScreen();
                    _playingGame = false;
                    break;

                default:
                    break;
                }
            }

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