Exemple #1
0
        public ItemType(RawItemType raw)
        {
            name        = raw.name;
            title       = raw.title ?? raw.name;
            description = raw.description;
            tool        = raw.tool;
            atlasXY     = raw.atlasXY;
            if (raw.requiredParts == null || raw.requiredParts.Length == 0)
            {
                requiredParts.Add(name); // single part item
            }
            else
            {
                requiredParts.AddRange(raw.requiredParts);
            }
            Type itemTagEnumType = typeof(ItemTagEnum);

            foreach (var tag in raw.tags)
            {
                string tag2 = tag.ToUpper();
                if (Enum.IsDefined(itemTagEnumType, tag2))
                {
                    tags.Add((ItemTagEnum)Enum.Parse(itemTagEnumType, tag2));
                }
                else
                {
                    Debug.LogError("tag " + tag2 + " not found");
                }
            }
        }
Exemple #2
0
 public ItemType(ItemType type, RawItemType rawType, string namePrefix)
 {
     name        = namePrefix + type.name;
     title       = rawType.title.Length == 0 ? name : rawType.title;
     description = rawType.description ?? type.description;
     tool        = rawType.tool ?? type.tool;
     foreach (var key in type.itemAspects.Keys)
     {
         itemAspects.Add(key, type.itemAspects[key]); // TODO clone aspects
     }
     atlasXY = rawType.atlasXY ?? type.atlasXY;
     color   = rawType.color ?? type.color;
 }