Esempio n. 1
0
        public void UnequipItem(ItemInst item)
        {
            BaseInst.UnequipItem(item.BaseInst);


            OnUnequip?.Invoke(item);
        }
    private void Unequip(EquipmentSlot equipmentSlot)
    {
        var go = _dictionary[equipmentSlot].gameObject;

        _dictionary.Remove(equipmentSlot);
        OnUnequip?.Invoke(go.GetComponent <WeaponData>());
        Destroy(go);
    }
Esempio n. 3
0
 public virtual void Unequip(EntityEquipable eq)
 {
     if (GetEquipped(eq.Type) == eq)
     {
         SetEquipped(eq.Type, null);
         OnUnequip.Invoke(master, eq);
     }
 }
Esempio n. 4
0
        public void UnequipItem(ItemInst item)
        {
            pBeforeUnequip(item);
            this.BaseInst.UnequipItem(item.BaseInst);
            pAfterUnequip(item);

            OnUnequip?.Invoke(item);
        }
Esempio n. 5
0
        public void UnequipFromBodySlot(BodyPart bodyPart)
        {
            var equip = activeEquipment[(int)bodyPart];

            if (equip != null)
            {
                OnUnequip?.Invoke(equip);
                activeEquipment[(int)bodyPart] = null;
            }
        }
Esempio n. 6
0
            public virtual void Unequip(EntityEquipableType type)
            {
                EntityEquipable oldEq = GetEquipped(type);

                if (oldEq != null)
                {
                    SetEquipped(type, null);
                    OnUnequip.Invoke(master, oldEq);
                }
            }
Esempio n. 7
0
 /// <summary>
 /// Unequips an item from the inventory
 /// </summary>
 /// <param name="obj">The object to unequip</param>
 public void Unequip(Entity entity)
 {
     for (var i = 0; i < activeEquipment.Length; ++i)
     {
         if (activeEquipment[i] == entity)
         {
             OnUnequip?.Invoke(entity);
             activeEquipment[i] = null;
             break;
         }
     }
 }
Esempio n. 8
0
        /// <summary>
        /// Unequips an item from the inventory by name
        /// </summary>
        /// <param name="name">The name of the equipment</param>
        public void Unequip(string name)
        {
            for (var i = 0; i < activeEquipment.Length; ++i)
            {
                var equip = activeEquipment[i];

                if (equip != null && (equip.name == name || equip.id == name))
                {
                    OnUnequip?.Invoke(equip);
                    activeEquipment[i] = null;
                    break;
                }
            }
        }
    private void Unequip(EquipmentSlot equipmentDataSlot, bool destroyGo = true)
    {
        var go = slotToGameobjectDictionary[equipmentDataSlot];

        slotToGameobjectDictionary.Remove(equipmentDataSlot);
        OnUnequip?.Invoke(equipmentDataSlot, go.GetComponent <EquipmentData>());
        equipment.Remove(go);

        if (!destroyGo)
        {
            return;
        }
        if (Application.isPlaying)
        {
            Destroy(go);
        }
        else
        {
            DestroyImmediate(go);
        }
    }