コード例 #1
0
    /// <summary>
    /// Un equip item at index of inventory
    /// </summary>
    /// <param name="item">Item to un equip</param>
    /// <param name="index">index of inventory</param>
    private void UnEquipItemAt(Item item, int index)
    {
        if (_playerInventory.AddItemAt(item, index) || _playerInventory.AddItem(item))
        {
            if (_playerInventory.GetItemType(index) == typeof(Weapon))
            {
                _playerUnit.SetItemMods(((PlayerUnitData)_playerUnit.unitData).equipment.mainHand.mods.stats, -1);
                ((PlayerUnitData)_playerUnit.unitData).EmptyMainHand();
            }
            else if (_playerInventory.GetItemType(index) == typeof(Armor))
            {
                _playerUnit.SetItemMods(((PlayerUnitData)_playerUnit.unitData).equipment.body.mods.stats, -1);
                ((PlayerUnitData)_playerUnit.unitData).EmptyBody();
            }
        }

        RefreshUnitEquipment();
        RefreshInventoryItems();
    }