Ejemplo n.º 1
0
    /// <summary>
    /// Equip the specified item. This method also updates and maintains the equipmentUI.
    /// </summary>
    /// <param name="item">Item to equip.</param>
    public override void Equip(Item item)
    {
        attributes.RegisterEquip(item);

        if (item.Type == ItemType.Weapon)
        {
            var wep = Instantiate(item.prefab);
            wep.transform.SetParent(weaponSlot.transform, false);

            if (wep != null)
            {
                weapon = wep.GetComponent <Weapon> ();
                weapon.Equip(calculateDamage());
            }
        }
        if (item.Type == ItemType.Offhand)
        {
        }
        if (item.Type == ItemType.Armor)
        {
        }
        //Instantiate armor - not added yet!!
    }