Пример #1
0
 static void AddItemBlueprintForSpell(BlueprintAbility spell, UsableItemType itemType, BlueprintItemEquipment item)
 {
     if (!spellIdToItem.ContainsKey(itemType))
     {
         spellIdToItem.Add(itemType, new Dictionary <string, List <BlueprintItemEquipment> >());
     }
     if (!spellIdToItem[itemType].ContainsKey(item.Ability.AssetGuid))
     {
         spellIdToItem[itemType][item.Ability.AssetGuid] = new List <BlueprintItemEquipment>();
     }
     spellIdToItem[itemType][item.Ability.AssetGuid].Add(item);
 }
Пример #2
0
        static List <BlueprintItemEquipment> FindItemBlueprintForSpell(BlueprintAbility spell, UsableItemType itemType)
        {
            if (!spellIdToItem.ContainsKey(itemType))
            {
                BlueprintItemEquipmentUsable[] allUsableItems = Resources.FindObjectsOfTypeAll <BlueprintItemEquipmentUsable>();
                foreach (BlueprintItemEquipmentUsable item in allUsableItems)
                {
                    if (item.Type == itemType)
                    {
                        AddItemBlueprintForSpell(spell, itemType, item);
                    }
                }
            }
            string spellId = spell.AssetGuid;

            return((spellIdToItem[itemType].ContainsKey(spellId)) ? spellIdToItem[itemType][spellId] : null);
        }