public void SetWeapon() { if (groupContent.GetFirstActiveToggle().GetComponentInParent <ItemList>().weapon != null) { mechanics.weaponEquipped = (groupContent.GetFirstActiveToggle().GetComponentInParent <ItemList>().weapon); mechanics.GetComponentInChildren <Atack>().SetWeapon(groupContent.GetFirstActiveToggle().GetComponentInParent <ItemList>().weapon.damage); GameObject.Find("WeaponSprite").GetComponent <Image>().sprite = mechanics.weaponEquipped.image; mechanics.SetWeapon(); } if (player.health < player.maxHealth) { if (groupContent.GetFirstActiveToggle().GetComponentInParent <ItemList>().consumableItem != null) { player.health += groupContent.GetFirstActiveToggle().GetComponentInParent <ItemList>().consumableItem.healthGain; if (player.health > player.maxHealth) { player.health = player.maxHealth; } { inventary.RemoveItem(groupContent.GetFirstActiveToggle().GetComponentInParent <ItemList>().consumableItem); Destroy(groupContent.GetFirstActiveToggle().GetComponentInParent <ItemList>().gameObject); } } } UpdateAtributtes(); }