Esempio n. 1
0
        public void RemoveItemFromInventory()
        {
            if (_currentGameItem != null)
            {
                GameItemModelQuantity selectedGameItemModelQuantity = _currentGameItem as GameItemModelQuantity;

                switch (_currentGameItem.GameItemModel)
                {
                case LightSaberParts lightSaber:
                    RemoveLightsaberPercent(lightSaber, selectedGameItemModelQuantity);
                    _player.UpdateMissionStatus();
                    break;

                case KyberCrystals kybercrystal:
                    RemoveLightsaberCrystalProgress(kybercrystal, selectedGameItemModelQuantity);
                    _player.UpdateMissionStatus();
                    break;

                default:
                    _currentLocation.AddGameItemModelToLocation(selectedGameItemModelQuantity);
                    _player.RemoveGameItemModelToInventory(selectedGameItemModelQuantity);
                    break;
                }
            }
        }
Esempio n. 2
0
        private string GenerateMissionLightsaberDetail(MissionLightsaberParts mission)
        {
            StringBuilder sb = new StringBuilder();

            sb.Clear();

            sb.AppendLine("All Required Lightsaber Parts");
            foreach (var gameItemModelQuantity in mission.RequiredgameItemModelQuantities)
            {
                sb.Append(TAB + gameItemModelQuantity.GameItemModel.Name);
                sb.AppendLine($" ( {gameItemModelQuantity.Quantity} ) ");
            }
            if (mission.Status == Mission.MissionStatus.Incomplete)
            {
                sb.AppendLine("Lightsaber Parts To Gather");
                foreach (var gameItemModelQuantity in mission.GameItemModelQuantityMissionToDo(_player.Inventory.ToList()))
                {
                    int quantityInInventory = 0;
                    GameItemModelQuantity gameItemModelQuantityGathered = _player.Inventory.FirstOrDefault(gi => gi.GameItemModel.Id == gameItemModelQuantity.GameItemModel.Id);
                    if (gameItemModelQuantityGathered != null)
                    {
                        quantityInInventory = gameItemModelQuantityGathered.Quantity;
                    }
                    sb.Append(TAB + gameItemModelQuantity.GameItemModel.Name);
                    sb.AppendLine($" ( {gameItemModelQuantity.Quantity - quantityInInventory} ) ");
                }
            }
            sb.Remove(sb.Length - 2, 2);

            return(sb.ToString());
        }
Esempio n. 3
0
        public void AddItemToInventory()
        {
            if (_currentGameItem != null && _currentLocation.GameItems.Contains(_currentGameItem))
            {
                GameItemModelQuantity selectedGameItemModelQuantity = _currentGameItem as GameItemModelQuantity;

                switch (_currentGameItem.GameItemModel)
                {
                case LightSaberParts lightSaber:
                    AddLightsaberProgress(lightSaber, selectedGameItemModelQuantity);
                    _player.UpdateMissionStatus();
                    break;

                case KyberCrystals kybercrystal:
                    AddLightsaberCrystalProgress(kybercrystal, selectedGameItemModelQuantity);
                    _player.UpdateMissionStatus();
                    _currentGameItem = _currentKyberCrystal;
                    break;

                default:
                    _currentLocation.RemoveGameItemModelFromLocation(selectedGameItemModelQuantity);
                    _player.AddGameItemModelToInventory(selectedGameItemModelQuantity);
                    break;
                }
            }
        }
Esempio n. 4
0
 private void AddLightsaberCrystalProgress(KyberCrystals kybercrystal, GameItemModelQuantity selectedGameItemModelQuantity)
 {
     if (_player.LightsaberProgress == 85)
     {
         _currentKyberCrystal        = _currentGameItem;
         _player.LightsaberProgress += kybercrystal.LightsaberProgress;
         _currentLocation.RemoveGameItemModelFromLocation(selectedGameItemModelQuantity);
         _player.AddGameItemModelToInventory(selectedGameItemModelQuantity);
     }
     else if (_player.LightsaberProgress == 100)
     {
         MessageBoxResult result = MessageBox.Show("Error: You are already holding a Kyber Crystal");
     }
     else
     {
         MessageBoxResult result = MessageBox.Show("Error: You need to gather all the lightsaber parts first.");
     }
 }
Esempio n. 5
0
 private void RemoveLightsaberPercent(LightSaberParts lightSaber, GameItemModelQuantity selectedGameItemModelQuantity)
 {
     _player.LightsaberProgress -= lightSaber.LightsaberProgress;
     _currentLocation.AddGameItemModelToLocation(selectedGameItemModelQuantity);
     _player.RemoveGameItemModelToInventory(selectedGameItemModelQuantity);
 }
Esempio n. 6
0
 private void RemoveLightsaberCrystalProgress(KyberCrystals kybercrystal, GameItemModelQuantity selectedGameItemModelQuantity)
 {
     _player.LightsaberProgress -= kybercrystal.LightsaberProgress;
     _currentLocation.AddGameItemModelToLocation(selectedGameItemModelQuantity);
     _player.RemoveGameItemModelToInventory(selectedGameItemModelQuantity);
 }
Esempio n. 7
0
 private void AddLightsaberProgress(LightSaberParts lightSaber, GameItemModelQuantity selectedGameItemModelQuantity)
 {
     _player.LightsaberProgress += lightSaber.LightsaberProgress;
     _currentLocation.RemoveGameItemModelFromLocation(selectedGameItemModelQuantity);
     _player.AddGameItemModelToInventory(selectedGameItemModelQuantity);
 }