Ejemplo n.º 1
0
    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.Z) && health.health > 0)
        {
            if (slot1.childCount != 0)
            {
                ItemIcon potion = slot1.GetChild(0).GetComponent <ItemIcon>();

                if (potion.item.typePotion.Equals("Health"))
                {
                    health.RestoreHealth(potion.item.value);
                    potion.PotionUsed();
                }
                else
                {
                    //fazer para potion de mana
                }
            }
        }

        if (Input.GetKeyDown(KeyCode.X) && health.health > 0)
        {
            if (slot2.childCount != 0)
            {
                ItemIcon potion = slot2.GetChild(0).GetComponent <ItemIcon>();
                potion.PotionUsed();
                if (potion.item.typePotion.Equals("Health"))
                {
                    health.RestoreHealth(potion.item.value);
                }
                else
                {
                    //fazer para potion de mana
                }
            }
        }
    }