Esempio n. 1
0
    public void InventoryButtonPressed(BaseItem item)
    {
        CloseInventory();
        if (villagerReference != null)
        {
            //Debug.Log ("Villager Reference is Valid");
            if (item.GetItemType() == BaseItem.ITEM_TYPE.ITEM_WEAPON)
            {
                if (item.GetComponent <Item_Shield> ())
                {
                    villagerReference.UnequipOffHand();
                    villagerReference.EquipWeaponToOffHand(item as BaseWeapon);
                    //Debug.Log ("Shield Equipped");
                    OpenCharacterInfoPanel();
                    return;
                }
                else if (equippingToMain)
                {
                    villagerReference.UnequipMainHand();
                    villagerReference.EquipWeaponToMainHand(item as BaseWeapon);
                    //Debug.Log ("Main hand Equipped");
                    OpenCharacterInfoPanel();
                    return;
                }
                else if (!equippingToMain)
                {
                    villagerReference.UnequipOffHand();
                    villagerReference.EquipWeaponToOffHand(item as BaseWeapon);
                    //Debug.Log ("Offhand Equipped");
                    OpenCharacterInfoPanel();
                    return;
                }
            }
            else if (item.GetItemType() == BaseItem.ITEM_TYPE.ITEM_ARMOR)
            {
                villagerReference.UnequipArmor();
                villagerReference.EquipArmor(item as BaseArmor);
                //Debug.Log ("Armor Equipped");
                OpenCharacterInfoPanel();
                return;
            }
        }

        //If no villager reference open dialog box to destroy or sell item

        //Debug.Log ("Nothing Equipped");
    }