/// <summary> /// get a SpaceTimeLocation object using an ID /// </summary> /// <param name="ID">space-time location ID</param> /// <returns>requested space-time location</returns> public SpaceTimeLocation GetSpaceTimeLocationByID(int ID) { SpaceTimeLocation spaceTimeLocation = null; // // run through the space-time 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 Space-Time Location ID {ID} does not exist in the current Universe."; throw new ArgumentException(ID.ToString(), feedbackMessage); } return(spaceTimeLocation); }
public static string CurrentLocationInfo(SpaceTimeLocation spaceTimeLocation) { string messageBoxText = $"Current Location: {spaceTimeLocation.CommonName}\n" + " \n" + spaceTimeLocation.Description; return(messageBoxText); }
public static string LookAround(SpaceTimeLocation spaceTimeLocation) { string messageBoxText = $"Current Location: {spaceTimeLocation.CommonName}\n" + " \n" + spaceTimeLocation.GeneralContents; return(messageBoxText); }
private void TravelAction() { // // get new location choice and update the current location property // _sar.SpaceTimeLocationID = _gameConsoleView.DisplayGetNextSpaceTimeLocation(); _currentLocation = _gameUniverse.GetSpaceTimeLocationById(_sar.SpaceTimeLocationID); // // set the game play screen to the current location info format // _gameConsoleView.DisplayGamePlayScreen("Current Location", Text.CurrentLocationInfo(_currentLocation), ActionMenu.MainMenu, ""); }
/// <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.Accessable == true) { return(true); } else { return(false); } }
public void DisplayLookAround() { // // get current space-time location // SpaceTimeLocation currentSpaceTimeLocation = _gameUniverse.GetSpaceTimeLocationById(_gameTraveler.SpaceTimeLocationID); // // get list of game objects in current space-time location // List <GameObject> gameObjectsInCurrentSpaceTimeLocation = _gameUniverse.GetGameObjectsBySpaceTimeLocationId(_gameTraveler.SpaceTimeLocationID); // // get list of NPCs in current space-time location // List <Npc> npcsInCurrentSpaceTimeLocation = _gameUniverse.GetNpcsBySpaceTimeLocationId(_gameTraveler.SpaceTimeLocationID); string messageBoxText = Text.LookAround(currentSpaceTimeLocation) + Environment.NewLine + Environment.NewLine; messageBoxText += Text.GameObjectsChooseList(gameObjectsInCurrentSpaceTimeLocation) + Environment.NewLine; messageBoxText += Text.NpcsChooseList(npcsInCurrentSpaceTimeLocation); DisplayGamePlayScreen("Current Location", messageBoxText, ActionMenu.MainMenu, ""); }
/// <summary> /// method to manage the application setup and game loop /// </summary> private void ManageGameLoop() { AdamaAction travelerActionChoice = AdamaAction.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(_sar.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 = GetNextTravelerAction(); // // choose an action based on the player's menu choice // switch (travelerActionChoice) { case AdamaAction.None: break; case AdamaAction.AdamaInfo: _gameConsoleView.DisplayTravelerInfo(_sar); break; case AdamaAction.LookAround: _gameConsoleView.DisplayLookAround(); break; case AdamaAction.Travel: TravelAction(); break; case AdamaAction.AdamaLocationsVisited: _gameConsoleView.DisplayLocationsVisited(); break; case AdamaAction.LookAt: LookAtAction(); break; case AdamaAction.PickUp: PickUpAction(); break; case AdamaAction.PutDown: PutDownAction(); break; case AdamaAction.Inventory: _gameConsoleView.DisplayInventory(); break; case AdamaAction.ListSpaceTimeLocations: _gameConsoleView.DisplayListOfSpaceTimeLocations(); break; case AdamaAction.ListNonPlayerCharacters: _gameConsoleView.DisplayListOfAllNpcObjects(); break; case AdamaAction.ListGameObjects: _gameConsoleView.DisplayListOfAllGameObjects(); break; case AdamaAction.TalkTo: TalkToAction(); break; case AdamaAction.TravelerMenu: ActionMenu.currentMenu = ActionMenu.CurrentMenu.TravelerMenu; _gameConsoleView.DisplayGamePlayScreen("Traveler Menu", "Select an operation from the menu.", ActionMenu.TravelerMenu, ""); break; case AdamaAction.AdminMenu: ActionMenu.currentMenu = ActionMenu.CurrentMenu.AdminMenu; _gameConsoleView.DisplayGamePlayScreen("Admin Menu", "Select an operation from the menu.", ActionMenu.AdminMenu, ""); break; case AdamaAction.ObjectMenu: ActionMenu.currentMenu = ActionMenu.CurrentMenu.ObjectMenu; _gameConsoleView.DisplayGamePlayScreen("Object Menu", "Select an operation from the menu.", ActionMenu.ObjectMenu, ""); break; case AdamaAction.ReturnToMainMenu: ActionMenu.currentMenu = ActionMenu.CurrentMenu.MainMenu; _gameConsoleView.DisplayGamePlayScreen("Current Location", Text.CurrentLocationInfo(_currentLocation), ActionMenu.MainMenu, ""); break; case AdamaAction.NonplayerCharacterMenu: ActionMenu.currentMenu = ActionMenu.CurrentMenu.NpcMenu; _gameConsoleView.DisplayGamePlayScreen("NPC Menu", "Select an operation from the menu.", ActionMenu.NpcMenu, ""); break; case AdamaAction.Exit: _playingGame = false; break; default: break; } } // // close the application // Environment.Exit(1); }
public void DisplayLookAround() { SpaceTimeLocation currentSpaceTimeLocation = _gameUniverse.GetSpaceTimeLocationByID(_gameTraveler.SpaceTimeLocationID); DisplayGamePlayScreen("Current Location", Text.LookAround(currentSpaceTimeLocation), ActionMenu.MainMenu, ""); }
/// <summary> /// method to manage the application setup and game loop /// </summary> private void ManageGameLoop() { AdamaAction travelerActionChoice = AdamaAction.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(_sar.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 AdamaAction.None: break; case AdamaAction.LookAround: _gameConsoleView.DisplayLookAround(); break; case AdamaAction.Travel: // // get new location choice and update the current location property // _sar.SpaceTimeLocationID = _gameConsoleView.DisplayGetNextSpaceTimeLocation(); _currentLocation = _gameUniverse.GetSpaceTimeLocationByID(_sar.SpaceTimeLocationID); // // set the game play screen to the current location info format // _gameConsoleView.DisplayGamePlayScreen("Current Location", Text.CurrentLocationInfo(_currentLocation), ActionMenu.MainMenu, ""); break; case AdamaAction.AdamaLocationsVisited: // // generate a list of space time locations that have been visited // List <SpaceTimeLocation> visitedSpaceTimeLocations = new List <SpaceTimeLocation>(); foreach (int spaceTimeLocationId in _sar.SpaceTimeLocationsVisited) { visitedSpaceTimeLocations.Add(_gameUniverse.GetSpaceTimeLocationByID(spaceTimeLocationId)); } _gameConsoleView.DisplayGamePlayScreen("Space-Time Locations Visited", Text.VisitedLocations(visitedSpaceTimeLocations), ActionMenu.MainMenu, ""); break; case AdamaAction.AdamaInfo: _gameConsoleView.DisplayTravelerInfo(); break; case AdamaAction.ListSpaceTimeLocations: _gameConsoleView.DisplayListOfSpaceTimeLocations(); break; case AdamaAction.Exit: _playingGame = false; break; default: break; } } // // close the application // Environment.Exit(1); }