Пример #1
0
        private void PopulateDrop(TypeDrop actualDrop)
        {
            switch (actualDrop)
            {
            case TypeDrop.Gold:
            {
                StatsManager.Instance.AddGold(CostDrop());
                break;
            }

            case TypeDrop.Weapon:
            {
                InfoWeapon iw = new InfoWeapon();
                iw.SetValues("Weapon", (float)RarityStats(), false, WeaponType.SimpleSword, WeaponEffect(), actualRarityDrop, 1f, CostDrop(), "/Weapons/" + IconNameWeapon());
                if (InventoryManager.Instance.AvailableWeaponSpace > 0)
                {
                    InventoryManager.Instance.AddToInventory(iw);
                }
                else
                {
                    StatsManager.Instance.AddGold(iw.SellValue);
                }

                break;
            }

            case TypeDrop.Armor:
            {
                InfoArmor      ia    = new InfoArmor();
                EquippedInSlot slot  = SlotArmor();
                Stats          stats = ArmorStats();
                ia.SetValues("Armadura", false, slot, CostDrop(), "Some description randomly to be implemented", stats, "/Armors/" + slot.ToString() + "/" + IconNameArmor(slot));
                if (InventoryManager.Instance.AvailableArmorSpace > 0)
                {
                    InventoryManager.Instance.AddToInventory(ia);
                }
                else
                {
                    StatsManager.Instance.AddGold(ia.SellValue);
                }
                break;
            }

            case TypeDrop.Item:
            {
                InfoItem ii = new InfoItem();
                ii.SetValues("Item", TypeItem.Other, "Some description randomly generated", ConsumeEffect.None, CostDrop(), 1, "/Items/" + IconNameItem());
                if (InventoryManager.Instance.AvailableItemSpace > 0)
                {
                    InventoryManager.Instance.AddToInventory(ii);
                }
                else
                {
                    StatsManager.Instance.AddGold(ii.SellValue);
                }
                break;
            }
            }
        }
Пример #2
0
 public void SetEquippedWeapon(InfoWeapon iw)
 {
     if (iw == _weaponEquipped)
     {
         return;
     }
     _weaponEquipped = iw;
     _weaponPlayer.RefreshWeapon(_weaponEquipped);
 }
Пример #3
0
        public InfoWeaponsDatabase GetAllWeaponsInInventory()
        {
            InfoWeapon[] weapons = new InfoWeapon[_weaponsInInventory.Count];
            _weaponsInInventory.Values.CopyTo(weapons, 0);
            InfoWeaponsDatabase iwd = new InfoWeaponsDatabase();

            foreach (InfoWeapon iw in weapons)
            {
                iwd.DataBase.Add(iw);
            }
            return(iwd);
        }
 /// <summary>
 /// Everytime this function is called we will change the weapon on the character.
 /// </summary>
 public void RefreshWeapon(InfoWeapon newWeapon)
 {
     _infoWeapon = newWeapon;
     if (_infoWeapon.ModelName != null)
     {
         _weaponObject = Resources.Load
                             (ControlManager.Instance.PathToWeaponModelsFolder + _infoWeapon.ModelName) as GameObject;
         //We instantiate the item with a little bit of space in x axis to not overlap
         //this must be resolved in unity as the pivot must be at the bottom always
         GameObject weapon = Instantiate(_weaponObject, this.transform.position + new Vector3(2f, 0f, 0f),
                                         Quaternion.identity, _weaponModelTransformParent);
         weapon.transform.SetParent(_weaponModelTransformParent, false);
         weapon.gameObject.name = _infoWeapon.Name;
     }
 }
Пример #5
0
        private void ReplaceEquippedWeapon(InfoWeapon iw, int index)
        {
            Stats actualStats = this.StatsEquipped;

            for (int i = 0; i < _weaponsInInventory.Count; i++)
            {
                if (_weaponsInInventory[i].IsEquipped == true)
                {
                    _weaponsInInventory[i].IsEquipped     = false;
                    _weaponsInInventory[index].IsEquipped = true;
                    SetEquippedWeapon(iw);
                }
                Equippement.UpdateWeaponEquipped(iw);
            }
        }
Пример #6
0
        public bool AddToInventory(InfoWeapon w)
        {
            if (_weaponsInInventory.Count >= _maxWeaponInPossesion)
            {
                return(false);
            }
            int index = 0;

            if (_freeIntWeapons.Count > 0)
            {
                index = _freeIntWeapons[0];
                _freeIntWeapons.RemoveAt(0);
            }
            else
            {
                index = _weaponsInInventory.Count;
            }
            _inventoryPanel.AddToInventory(InventorySlotType.Weapon, EquippedInSlot.WeaponSlot, w.ModelName, index);
            _weaponsInInventory.Add(index, w);
            return(true);
        }
Пример #7
0
 public void SetInfoWeapon(InfoWeapon infoWeapon)
 {
     _weaponEffect = infoWeapon.WeaponEffect;
 }
 public void SetInfoWeapon(InfoWeapon infoWeapon)
 {
     _damageWeapon = infoWeapon.Damage;
     _weaponEffect = infoWeapon.WeaponEffect;
 }