public CreatureType process(RawCreatureType raw)
        {
            CreatureType type = new CreatureType(raw);

            if (!typeMap.templates.ContainsKey(raw.bodyTemplate))
            {
                Debug.LogWarning("Creature " + type.name + " has invalid body template " + raw.bodyTemplate);
                return(null);
            }

            // if(type.combinedAppearance != null) type.combinedAppearance.process();

            // Arrays.stream(GameplayStatEnum.values())
            //     .forEach(value -> type.statMap.put(value, value.DEFAULT)); // save default values
            // for (String statName : raw.statMap.keySet()) { // override default values
            //     if (GameplayStatEnum.map.containsKey(statName)) {
            //         type.statMap.put(GameplayStatEnum.map.get(statName), raw.statMap.get(statName));
            //     } else {
            //         Logger.LOADING.logError("Invalid stat name " + statName + " in creature type " + raw.name);
            //     }
            // }
            BodyTemplate template = typeMap.templates[raw.bodyTemplate];

            foreach (var part in template.body.Values)
            {
                type.bodyParts.Add(part.name, part.clone());
            }
            foreach (var slot in template.slots)
            {
                type.slots.Add(slot.Key, new List <string>(slot.Value));
            }
            type.desiredSlots.AddRange(raw.desiredSlots);
            // type.needs.AddRange(defaultNeeds);
            return(type);
        }
Пример #2
0
        // public CombinedAppearance combinedAppearance;
        // public readonly Dictionary<GameplayStatEnum, float> statMap = new HashMap<>();

        public CreatureType(RawCreatureType rawType)
        {
            name        = rawType.name;
            title       = rawType.title;
            description = rawType.description;
            atlasXY     = rawType.atlasXY;
            color       = rawType.color;
            aspects.AddRange(rawType.aspects);
            // combinedAppearance = rawType.combinedAppearance;
        }