/// <summary> /// get a RoomLocation object using an Id /// </summary> /// <param name="Id">room location ID</param> /// <returns>requested room location</returns> public RoomLocation GetRoomLocationById(int Id) { RoomLocation roomLocation = null; // // run through the room location list and grab the correct one // foreach (RoomLocation location in _roomLocations) { if (location.RoomLocationID == Id) { roomLocation = location; } } // // the specified ID was not found in the universe // throw an exception // if (roomLocation == null) { string feedbackMessage = $"The Room {Id} does not exist in the hotel."; throw new ArgumentException(Id.ToString(), feedbackMessage); } return(roomLocation); }
/// <summary> /// gets a room location ID choosen from the user /// </summary> public RoomLocation GetRoomLocationById(int id) { RoomLocation roomLocation = null; // // shift through roomLocation list and select correct one // foreach (RoomLocation location in _roomLocations) { if (location.RoomLocationID == id) { roomLocation = location; } } // // if the ID is not found wihtin the universe, // throw an exception // if (roomLocation == null) { string feedbackMessage = $"The Room Location ID, {id}, does not exist on the current Map."; throw new ArgumentException(id.ToString(), feedbackMessage); } return(roomLocation); }
public static string LookAround(RoomLocation roomLocation) { string messageBoxText = $"Current Location: {roomLocation.CommonName}\n" + " \n" + roomLocation.Description; return(messageBoxText); }
/// <summary> /// allows user to "look around" their current location, and /// displays location's general contents /// </summary> public static string LookAround(RoomLocation roomLocation) { string messageBox = $"Current Location: \n" + "Coordinates: \n" + " \n" + roomLocation.GeneralContents; return(messageBox); }
public static string TravelerInfo(Hero gameTraveler, RoomLocation currentLocation) { string messageBoxText = $"\tTraveler Name: {gameTraveler.Name}\n" + $"\tTraveler Age: {gameTraveler.Age}\n" + $"\tTraveler Race: {gameTraveler.Class}\n" + " \n" + $"\tCurrent Location: {currentLocation.CommonName}\n" + " \n"; return(messageBoxText); }
/// <summary> /// process the Travel action /// </summary> private void TravelAction() { // // get new location choice and update the current location property // _gameHero.RoomLocationID = _gameConsoleView.DisplayGetNextRoomLocation(); _currentLocation = _gameHotel.GetRoomLocationById(_gameHero.RoomLocationID); // // display the new room location info // _gameConsoleView.DisplayCurrentLocationInfo(); }
/// <summary> /// determine if a location is accessible to the player /// </summary> /// <param name="roomLocationId"></param> /// <returns>accessible</returns> public bool IsAccessibleLocation(int roomLocationId) { RoomLocation roomLocation = GetRoomLocationById(roomLocationId); if (roomLocation.Accessible == true) { return(true); } else { return(false); } }
/// <summary> /// displays current location info /// </summary> public static string CurrentLocationInfo(RoomLocation roomLocation) { string messageBox = "Current Location: \n" + "Coordinates: \n" + " \n" + " \n" + roomLocation.Description + " \n" + " \n" + "\tChoose from the menu options to proceed.\n"; return(messageBox); }
public void DisplayLookAround() { // // get current room location // RoomLocation currentRoomLocation = _gameHotel.GetRoomLocationById(_gameHero.RoomLocationID); // // get list of game objects in current room location // List <GameObject> gameObjectsInCurrentRoomLocation = _gameHotel.GetGameObjectsByRoomLocationId(_gameHero.RoomLocationID); // // get list of NPCs in current room location // List <Npc> npcsInCurrentRoomLocation = _gameHotel.GetNpcsByRoomLocationId(_gameHero.RoomLocationID); string messageBoxText = Text.LookAround(currentRoomLocation) + Environment.NewLine + Environment.NewLine; messageBoxText += Text.GameObjectsChooseList(gameObjectsInCurrentRoomLocation) + Environment.NewLine; messageBoxText += Text.NpcsChooseList(npcsInCurrentRoomLocation); DisplayGamePlayScreen("Current Location:", messageBoxText, ActionMenu.MainMenu, ""); }
/// <summary> /// method to manage the application setup and game loop /// </summary> private void ManageGameLoop() { HeroAction heroActionChoice = HeroAction.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 hero // InitializeMission(); // // prepare game play screen // _currentLocation = _gameHotel.GetRoomLocationById(_gameHero.RoomLocationID); _gameConsoleView.DisplayGamePlayScreen("Current Location", Text.CurrentLocationInfo(), ActionMenu.MainMenu, ""); // // game loop // while (_playingGame) { // // process all flags, events, and stats // UpdateGameStatus(); // // get next game action from player // heroActionChoice = GetNextHeroAction(); // // choose an action based on the user's menu choice // switch (heroActionChoice) { case HeroAction.None: break; case HeroAction.HeroInfo: _gameConsoleView.DisplayHeroInfo(); break; case HeroAction.LookAround: _gameConsoleView.DisplayLookAround(); break; case HeroAction.Travel: TravelAction(); break; case HeroAction.HeroLocationsVisited: _gameConsoleView.DisplayLocationsVisited(); break; case HeroAction.LookAt: LookAtAction(); break; case HeroAction.PickUp: PickUpAction(); break; case HeroAction.PutDown: PutDownAction(); break; case HeroAction.Inventory: _gameConsoleView.DisplayInventory(); break; case HeroAction.TalkTo: TalkToAction(); break; case HeroAction.ListRoomLocations: _gameConsoleView.DisplayListOfRoomLocations(); break; case HeroAction.ListGameObjects: _gameConsoleView.DisplayListOfAllGameObjects(); break; case HeroAction.ListNonplayerCharacters: _gameConsoleView.DisplayListOfAllNpcObjects(); break; case HeroAction.HeroMenu: ActionMenu.currentMenu = ActionMenu.CurrentMenu.HeroMenu; _gameConsoleView.DisplayGamePlayScreen("Hero Menu", "Select an operation from the menu.", ActionMenu.HeroMenu, ""); break; case HeroAction.ObjectMenu: ActionMenu.currentMenu = ActionMenu.CurrentMenu.ObjectMenu; _gameConsoleView.DisplayGamePlayScreen("Object Menu", "Select an operation from the menu.", ActionMenu.ObjectMenu, ""); break; case HeroAction.NonplayerCharacterMenu: ActionMenu.currentMenu = ActionMenu.CurrentMenu.NpcMenu; _gameConsoleView.DisplayGamePlayScreen("NPC Menu", "Select an operation from the menu.", ActionMenu.NpcMenu, ""); break; case HeroAction.AdminMenu: ActionMenu.currentMenu = ActionMenu.CurrentMenu.AdminMenu; _gameConsoleView.DisplayGamePlayScreen("Admin Menu", "Select an operation from the menu.", ActionMenu.AdminMenu, ""); break; case HeroAction.ReturnToMainMenu: ActionMenu.currentMenu = ActionMenu.CurrentMenu.MainMenu; _gameConsoleView.DisplayGamePlayScreen("Current Location", Text.CurrentLocationInfo(_currentLocation), ActionMenu.MainMenu, ""); break; case HeroAction.Exit: _playingGame = false; break; default: break; } } // // close the application // Environment.Exit(1); }
/// <summary> /// display all relevant information about the current location /// </summary> public void DisplayCurrentLocationInfo() { RoomLocation currentRoomLocation = _gameHotel.GetRoomLocationById(_gameHero.RoomLocationID); DisplayGamePlayScreen("Current Location", Text.CurrentLocationInfo(currentRoomLocation), ActionMenu.MainMenu, ""); }
public void DisplayHeroInfo() { RoomLocation currentSpaceTimeLocation = _gameHotel.GetRoomLocationById(_gameHero.RoomLocationID); DisplayGamePlayScreen("Traveler Information", Text.TravelerInfo(_gameHero, currentSpaceTimeLocation), ActionMenu.HeroMenu, ""); }