/// <summary>
        /// process the Pick Up action
        /// </summary>
        private void PickUpAction()
        {
            //
            // display a list of traveler objects in space-time location and get a player choice
            //
            int travelerObjectToPickUpId = _gameConsoleView.DisplayGetTravelerObjectToPickUp();

            //
            // 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 the space-time location is set to 0
                //
                _gameTraveler.Inventory.Add(travelerObject);
                travelerObject.SpaceTimeLocationId = 0;

                //
                // display confirmation message
                //
                _gameConsoleView.DisplayConfirmTravelerObjectAddedToInventory(travelerObject);
            }
        }
Example #2
0
        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);
                }
            }
        }