Example #1
0
    public void ToggleEquipAbility()
    {
        InventoryHolder invHolder    = ItemManager.Instance.GetInvHolder(itemsDisplay.CurrentPossessor);
        Equipment       itemToToggle = (Equipment)ItemManager.Instance.GetItemAt(itemsDisplay.SelectedPos, itemsDisplay.CurrentPossessor);

        itemToToggle.ToggleEquipAbility(PossessorSearcher.GetPossessor(itemsDisplay.CurrentPossessor));

        if (invHolder.ItemHolders[itemsDisplay.SelectedPos].IsEquipped)
        {
            OrganizeAfterToggle(invHolder, itemsDisplay.SelectedPos, false);
        }
        else
        {
            int equippedItemPos = invHolder.FindSameEquippedType(itemToToggle);

            if (equippedItemPos != InventoryHolder.POSITION_INVALID)
            {
                OrganizeAfterToggle(invHolder, equippedItemPos, false);
            }

            OrganizeAfterToggle(invHolder, itemsDisplay.SelectedPos, true);
        }

        itemsDisplay.DisplayAll();
    }