public int DisplayGetPlayerObjectToPickUp() { int gameObjectId = 0; bool validGameObjectId = false; // // get a list of player objects in the current map location // List <PlayerObject> playerObjectsInMapLocation = _gameKingdom.GetPlayerObjectsByMapLocationId(_gamePlayer.MapLocationID); if (playerObjectsInMapLocation.Count > 0) { DisplayGamePlayScreen("Pick Up Game Object", Text.GameObjectsChooseList(playerObjectsInMapLocation), ActionMenu.ObjectMenu, ""); while (!validGameObjectId) { // // get an integer from the player // GetInteger($"Enter the Id number of the object you wish to add to your inventory: ", 0, 0, out gameObjectId); // // validate integer as a valid game object id and in current location // if (_gameKingdom.IsValidPlayerObjectByLocationId(gameObjectId, _gamePlayer.MapLocationID)) { PlayerObject playerObject = _gameKingdom.GetGameObjectById(gameObjectId) as PlayerObject; validGameObjectId = true; //if (playerObject.CanInventory) //{ // validGameObjectId = true; //} //else //{ // ClearInputBox(); // DisplayInputErrorMessage("It appears you may not inventory that object. Please try again."); //} } else { ClearInputBox(); DisplayInputErrorMessage("It appears you entered an invalid game object id. Please try again."); } } } else { DisplayGamePlayScreen("Pick Up Game Object", "It appears there are no game objects here.", ActionMenu.ObjectMenu, ""); } return(gameObjectId); }
/// <summary> /// process the Look At action /// </summary> private void LookAtAction() { // // display a list of game objects in map location and get a player choice // int gameObjectToLookAtId = _gameConsoleView.DisplayGetGameObjectToLookAt(); // // display game object info // if (gameObjectToLookAtId != 0) { // // get the game object from the kingdom // GameObject gameObject = _gameKingdom.GetGameObjectById(gameObjectToLookAtId); // // display information for the object chosen // _gameConsoleView.DisplayGameObjectInfo(gameObject); } }
/// <summary> /// initialize the major game objects /// </summary> private void InitializeGame() { _gamePlayer = new Player(); _gameKingdom = new Kingdom(); _gameConsoleView = new ConsoleView(_gamePlayer, _gameKingdom); _playingGame = true; // //add initial items to player inventory // _gamePlayer.Inventory.Add(_gameKingdom.GetGameObjectById(12) as PlayerObject); _gamePlayer.MapLocationID = 1; Console.CursorVisible = false; }