示例#1
0
    private void DropItem()
    {
        try {
            bool hasWeaponEquipped = (m_Inventory.CurrentWeapon != Consts.NULL_ITEM_ID);
            int  itemID            = m_Inventory.DropSelectedItem();
            if (itemID != Consts.NULL_ITEM_ID)
            {
                DropItem(itemID);
                m_UI.DropSelectedItem();

                if (ItemManager.IsWeaponItem(itemID))
                {
                    int curWeapon = m_Inventory.CurrentWeapon;
                    if (hasWeaponEquipped && curWeapon == Consts.NULL_ITEM_ID)
                    {
                        m_Weapon.Unequip();
                    }
                }
            }
        }
        catch (System.InvalidOperationException) { }
    }