public static Equipment AddEquipment(this ItemStack itemStack, EquipmentItemMaster equipmentItemMaster) { equipmentItemMaster.stats = equipmentItemMaster.stats is null ? new StatsModificator() : equipmentItemMaster.stats; itemStack._equipment = itemStack.gameObject.GetOrAddComponent <Equipment>(); itemStack._equipment.Init(equipmentItemMaster); Equipment equipment = itemStack._equipment; equipment.onEquipmentEnchanted = (Action)Delegate.Remove(equipment.onEquipmentEnchanted, new Action(itemStack.SetIdleMaterial)); Equipment equipment2 = itemStack._equipment; equipment2.onEquipmentEnchanted = (Action)Delegate.Combine(equipment2.onEquipmentEnchanted, new Action(itemStack.SetIdleMaterial)); return(itemStack._equipment); }
public ItemStack CreateItemStack <T>(EquipmentItemMaster equipmentItemMaster) where T : Item { return(CreateItemStack <T, EquipmentItemMaster>(equipmentItemMaster)); }
public ItemStack CreateItemStack <T>(EquipmentItemMaster itemMaster) where T : Potion, new() { var itemStack = CreateItemStack <T, EquipmentItemMaster>(itemMaster); return(itemStack); }