Ejemplo n.º 1
0
    public void EquipItem(string id)
    {
        Item item = _database.GetItemDataByID(id);

        if (CheckItemQuantity(id) > 0)
        {
            switch (item.Type)
            {
            case ItemType.Consumable:
                if (_player.Consumables.Count < 4)
                {
                    _inventoryScript.AddConsumable(item);
                    _player.Consumables.Add(_database.GetConsumable(item.ID));
                    DecreaseItemCount(id, 1);
                }
                break;

            case ItemType.Equipment:
                _inventoryScript.AddArmor(item);
                _player.Armor = _database.GetEquipment(id);
                DecreaseItemCount(id, 1);
                break;

            case ItemType.Weapon:
                _inventoryScript.AddWeapon(item);
                _player.Weapon = _database.GetEquipment(id);
                DecreaseItemCount(id, 1);
                break;
            }
        }
    }