/// <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; return(spaceTimeLocation); }
private void TravelAction() { GameObject keyObject = _gameUniverse.GetGameObjectById(10); // // Looks for the key object in the traveler's inventory. If found set all locations accesbility to true // if (_gameTraveler.Inventory.Contains(keyObject)) { foreach (SpaceTimeLocation location in _gameUniverse.SpaceTimeLocations) { location.Accessible = true; } } // // get new location choice and update the current location property // _gameTraveler.SpaceTimeLocationID = _gameConsoleView.DisplayGetNextSpaceTimeLocation(); _currentLocation = _gameUniverse.GetSpaceTimeLocationById(_gameTraveler.SpaceTimeLocationID); // // display the new space-time location info // _gameConsoleView.DisplayCurrentLocationInfo(); }
public static string CurrentLocationInfo(SpaceTimeLocation spaceTimeLocation) { string messageBoxText = $"You are currently in the region: {spaceTimeLocation.Region}\n" + $"Current Location: {spaceTimeLocation.CommonName}\n" + $"Accesible Regions: \n"; string regionsList = null; foreach (SpaceTimeLocation.RegionName region in spaceTimeLocation.AccessabelRegions) { regionsList += $"\t{region}".PadRight(10) + "\n"; } messageBoxText += regionsList; messageBoxText += Environment.NewLine + $"Radiation Level: {spaceTimeLocation.Radiation} \n" + Environment.NewLine + $"{spaceTimeLocation.Description}" + Environment.NewLine + Environment.NewLine + "\tChoose from the menu options to continue."; return(messageBoxText); }
/// <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 LookAround(SpaceTimeLocation spaceTimeLocation) { string messageBoxText = $"Currrent Location: {spaceTimeLocation.CommonName}\n" + " \n" + spaceTimeLocation.GeneralContents; return(messageBoxText); }
public static string CurrentLocationInfo(SpaceTimeLocation spaceTimeLocation) { string messageBoxText = $"Current Location: {spaceTimeLocation.CommonName}\n" + " \n" + spaceTimeLocation.Description; return(messageBoxText); }
private void PickUpAction() { // // display a list of traveler objects in space-time location and get a player choice // int travelerObjectToPickUpId = _gameConsoleView.DisplayGetTravelerObjectsToPickUp(); // // add the traveler object to traveler's inventory // if (travelerObjectToPickUpId != 0) { // // get the game object from the universe // TravelerObject travelerObject = _gameUniverse.GetGameObjectById(travelerObjectToPickUpId) as TravelerObject; // // note: traveler object is added to list and space-time location is set to 0 _gameTraveler.Inventory.Add(travelerObject); travelerObject.SpaceTimeLocationId = 0; _gameTraveler.ExperiencePoints += travelerObject.ExperiencePoints; if (travelerObject.Id == 11 && _gameTraveler.Inventory.Contains(_gameUniverse.GetGameObjectById(12)) || travelerObject.Id == 12 && _gameTraveler.Inventory.Contains(_gameUniverse.GetGameObjectById(11))) { _gameTraveler.Lives += 1; _gameConsoleView.DisplayGamePlayScreen("Pick Up Game Object", Text.HeartStonesFound(travelerObject), ActionMenu.MainMenu, ""); } else if (travelerObject.Id == 13) { _gameTraveler.Health -= 30; _gameConsoleView.DisplayGamePlayScreen("Pick Up Game Object", Text.RadiarionFound(travelerObject), ActionMenu.MainMenu, ""); } else if (travelerObject.Id == 14) { _gameTraveler.Lives -= 1; _gameTraveler.Inventory.Remove(travelerObject); _gameTraveler.SpaceTimeLocationID = -1; _gameConsoleView.DisplayGamePlayScreen("Pick Up Game Object", Text.BombFound(travelerObject), ActionMenu.MainMenu, ""); } else if (travelerObject.Id == 15) { int newId; int currentId = _currentLocation.SpaceTimeLocationID; do { newId = _gameConsoleView.GetRandomNumber(); _gameTraveler.SpaceTimeLocationID = newId; _currentLocation = _gameUniverse.GetSpaceTimeLocationById(_gameTraveler.SpaceTimeLocationID); } while (newId == currentId); _gameConsoleView.DisplayGamePlayScreen("Pick Up Game Object", Text.Transporter(travelerObject, _currentLocation), ActionMenu.MainMenu, ""); } else { _gameConsoleView.DisplayConfirmTravelerObjectAddedToInventory(travelerObject); } } }
public static string Transporter(GameObject gameObject, SpaceTimeLocation newLocation) { string messageBoxText = "WOW!!\n" + $"The transporter worked. You have been transported to {newLocation.CommonName}.\n" + " \n" + $"{gameObject.Name} was aslo added to your inevntory."; return(messageBoxText); }
public static string TravelerInfo(Traveler gameTraveler, SpaceTimeLocation currentLocation) { string messageBoxText = $"\tTraveler Name: {gameTraveler.Name}\n" + $"\tTraveler Age: {gameTraveler.Age}\n" + $"\tTraveler Race: {gameTraveler.Race}\n" + " \n" + $"\tCurrent Location: {currentLocation.CommonName}\n" + " \n"; return(messageBoxText); }
/// <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); } }
/// <summary> /// process the Travel action /// </summary> private void TravelAction() { // // get new location choice and update the current location property // _gameTraveler.SpaceTimeLocationID = _gameConsoleView.DisplayGetNextSpaceTimeLocation(); _currentLocation = _gameUniverse.GetSpaceTimeLocationById(_gameTraveler.SpaceTimeLocationID); // // display the new space-time location info // _gameConsoleView.DisplayCurrentLocationInfo(); }
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); string messageBoxText = Text.LookAround(currentSpaceTimeLocation) + Environment.NewLine + Environment.NewLine; messageBoxText += Text.GameObjectsChooseList(gameObjectsInCurrentSpaceTimeLocation); DisplayGamePlayScreen("Current Location", messageBoxText, 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, Traveler gameTraveler) { SpaceTimeLocation spaceTimeLocation = GetSpaceTimeLocationById(spaceTimeLocationId); SpaceTimeLocation currentLocation = GetSpaceTimeLocationById(gameTraveler.SpaceTimeLocationID); if (spaceTimeLocation.AccessabelRegions.Contains(currentLocation.Region)) { if (gameTraveler.ExperiencePoints >= spaceTimeLocation.EntryPoints) { return(true); } else { return(false); } } else { return(false); } }
public static string LookAround(SpaceTimeLocation spaceTimeLocation, Dictionary <string, int> contentValues) { string messageBoxText = $"Current Location: {spaceTimeLocation.CommonName}\n" + " \n"; string contents = null; foreach (var content in contentValues) { if (spaceTimeLocation.GeneralContents.Contains(content.Key)) { contents += $"{content.Key}, health points = {content.Value}\n"; } } messageBoxText += contents; return(messageBoxText); }
/// <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("Mission Intro", Text.MissionIntro(), ActionMenu.MissionIntro, ""); _gameConsoleView.GetContinueKey(); // // initialize the mission traveler // InitializeMission(); // // prepare game play screen // _currentLocation = _gameUniverse.GetSpaceTimeLocationById(_gamePlayer.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 PlayerAction.None: break; case PlayerAction.PlayerInfo: _gameConsoleView.DisplayTravelerInfo(); break; case PlayerAction.LookAround: _gameConsoleView.DisplayLookAround(); break; case PlayerAction.Travel: // Update accessibility UpdateAccessibility(); // // get new location choice and update the current location property // _gamePlayer.SpaceTimeLocationID = _gameConsoleView.DisplayGetNextSpaceTimeLocation(); _currentLocation = _gameUniverse.GetSpaceTimeLocationById(_gamePlayer.SpaceTimeLocationID); // // set the game play screen to the current location info format // _gameConsoleView.DisplayGamePlayScreen("Current Location", Text.CurrentLocationInfo(_currentLocation), ActionMenu.MainMenu, ""); break; case PlayerAction.PlayerLocationsVisited: _gameConsoleView.DisplayLocationsVisited(); break; case PlayerAction.ListSpaceTimeLocations: _gameConsoleView.DisplayListOfSpaceTimeLocations(); break; case PlayerAction.Exit: _playingGame = false; break; default: break; } } // // close the application // Environment.Exit(0); }
public void DisplayCurrentLocationInfo() { SpaceTimeLocation currentSpaceTimeLocation = _gameUniverse.GetSpaceTimeLocationById(_gameTraveler.SpaceTimeLocationID); DisplayGamePlayScreen("Current Location", Text.CurrentLocationInfo(currentSpaceTimeLocation), ActionMenu.MainMenu, ""); }
/// <summary> /// method to manage the application setup and game loop /// </summary> private void ManageGameLoop() { TravelerAction travelerActionChoice = TravelerAction.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(_gameTraveler.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 // 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 player's menu choice // switch (travelerActionChoice) { case TravelerAction.None: break; case TravelerAction.TravelerInfo: _gameConsoleView.DisplayTravelerInfo(); break; case TravelerAction.LookAround: _gameConsoleView.DisplayLookAround(); break; case TravelerAction.Travel: TravelAction(); break; case TravelerAction.TravelerLocationsVisited: _gameConsoleView.DisplayLocationsVisited(); break; case TravelerAction.LookAt: LookAtAction(); break; case TravelerAction.PickUp: PickUpAction(); break; case TravelerAction.PutDown: PutDownAction(); break; case TravelerAction.Inventory: _gameConsoleView.DisplayInventory(); break; case TravelerAction.ListSpaceTimeLocations: _gameConsoleView.DisplayListOfSpaceTimeLocations(); break; case TravelerAction.ListGameObjects: _gameConsoleView.DisplayListOfAllGameObjects(); break; case TravelerAction.AdminMenu: ActionMenu.currentMenu = ActionMenu.CurrentMenu.AdminMenu; _gameConsoleView.DisplayGamePlayScreen("Admin Menu", "Select an operation from the menu.", ActionMenu.AdminMenu, ""); break; case TravelerAction.ReturnToMainMenu: ActionMenu.currentMenu = ActionMenu.CurrentMenu.MainMenu; _gameConsoleView.DisplayGamePlayScreen("Current Location", Text.CurrentLocationInfo(_currentLocation), ActionMenu.MainMenu, ""); break; case TravelerAction.Exit: _playingGame = false; break; default: break; } } // // close the application // Environment.Exit(1); }
/// <summary> /// display all relevant information about the traveler /// </summary> public void DisplayTravelerInfo() { SpaceTimeLocation currentSpaceTimeLocation = _gameUniverse.GetSpaceTimeLocationById(_gameTraveler.SpaceTimeLocationId); DisplayGamePlayScreen("Traveler Information", Text.TravelerInfo(_gameTraveler, currentSpaceTimeLocation), ActionMenu.TravelerMenu, ""); }
/// <summary> /// Display Look Around method from the Text class /// </summary> public void DisplayLookAround() { SpaceTimeLocation currentSpaceTimeLocation = _gameUniverse.GetSpaceTimeLocationById(_gameTraveler.SpaceTimeLocationID); DisplayGamePlayScreen("Current Location", Text.LookAround(currentSpaceTimeLocation, _gameUniverse.ContentValues), ActionMenu.MainMenu, ""); }