Ejemplo n.º 1
0
 public void OnItemUnequipped(ItemUnequipped message)
 {
     if (Manager.GetComponent(message.Item, Weapon.TypeId) != null)
     {
         // Weapon was unequipped, stop tracking.
         _cooldowns.Remove(message.Item);
     }
 }
Ejemplo n.º 2
0
 public void OnItemUnequipped(ItemUnequipped message)
 {
     if (Manager.GetComponent(message.Item, Attribute <TAttribute> .TypeId) != null)
     {
         var attributes =
             ((Attributes <TAttribute>)
              Manager.GetComponent(message.Slot.Root.Entity, Attributes <TAttribute> .TypeId));
         if (attributes != null)
         {
             attributes.RecomputeAttributes();
         }
     }
 }
Ejemplo n.º 3
0
        public void OnItemUnequipped(ItemUnequipped message)
        {
            // Check if we can show effects.
            var effects = (ParticleEffects)Manager.GetComponent(message.Slot.Root.Entity, ParticleEffects.TypeId);

            if (effects == null)
            {
                return;
            }

            // OK, remove the effects, if there are any.
            foreach (ItemEffect effect in Manager.GetComponents(message.Item, ItemEffect.TypeId))
            {
                effects.Remove(effect.Id);
            }
        }
Ejemplo n.º 4
0
    public void RemoveItem(EquipmentType slot)
    {
        if (!CheckEmptySlot(slot))
        {
            ItemUnequipped itemUnequipped = new ItemUnequipped(equipmentDict[slot]);

            EventManager.Current.TriggerEvent(itemUnequipped);

            PopupText.Instance.GenerateText(equipmentDict[slot].name + " Destroyed!");


            equipmentDict[slot].Unequip();

            equipmentDict.Remove(slot);
        }
    }
Ejemplo n.º 5
0
        public void Unequip(Item item, Item target = null)
        {
            if (item.IsEmpty)
            {
                throw new Exception("Trying to unequip empty item.");
            }

            if (item.IsAnySkillOnCooldown())
            {
                throw new SkillIsOnCooldownException();
            }

            var slot = FindContainingSlot(item);

            if (slot == null)
            {
                throw new Exception($"Item {item.Name} #{item.GetHashCode()} is not equipped.");
            }

            item.Equipment = null;

            if (target == null || target.Inventory == null)
            {
                item.Inventory.Pickup(slot.Item);
            }
            else
            {
                target.Inventory.Pickup(slot.Item, target);
            }

            slot.Clear();

            RemoveItemBonuses(item, slot);
            RemoveVisuals(item, slot);

            item.EquipmentSlot = null;

            ItemUnequipped?.Invoke(item);
        }
Ejemplo n.º 6
0
 public void OnItemUnequipped(ItemUnequipped message)
 {
     _changedShape.Add(message.Slot.Root.Entity);
 }
Ejemplo n.º 7
0
        public override Component Copy()
        {
            var equipment = new EquipmentComponent(new List <string>(_slots));

            foreach (var equippedItem in _equippedItems)
            {
                equipment._equippedItems.Add(equippedItem.Key, equippedItem.Value.Copy());
            }

            if (ItemEquipped != null)
            {
                equipment.ItemEquipped = (ComponentEventHandler <EquipmentComponent, EventArgs <string, Entity> >)ItemEquipped.Clone();
            }
            if (ItemUnequipped != null)
            {
                equipment.ItemUnequipped = (ComponentEventHandler <EquipmentComponent, EventArgs <string, Entity> >)ItemUnequipped.Clone();
            }

            return(equipment);
        }
Ejemplo n.º 8
0
 private void OnItemUnequipped()
 {
     ItemUnequipped?.Invoke(this, EventArgs.Empty);
 }
Ejemplo n.º 9
0
    void ClearSlot(ItemUnequipped item)
    {
        ItemSlot slot = equipmentSlotDict[item.equipment.equipmentType];

        slot.SetDefault();
    }