protected void CreateDwarfSprite(CreatureClass employeeClass, ComponentManager manager)
        {
            if (Physics == null)
            {
                if (GetRoot().GetComponent <Physics>().HasValue(out var physics))
                {
                    Physics = physics;
                }
                else
                {
                    return;
                }
            }

            var sprite = Physics.AddChild(new LayeredSprites.LayeredCharacterSprite(manager, "Sprite", Matrix.CreateTranslation(new Vector3(0, 0.15f, 0)))) as LayeredSprites.LayeredCharacterSprite;

            var random = new Random(Stats.RandomSeed);

            var hairPalette = LayeredSprites.LayerLibrary.EnumeratePalettes().Where(p => p.Layer.Contains("hair")).SelectRandom(random);
            var skinPalette = LayeredSprites.LayerLibrary.EnumeratePalettes().Where(p => p.Layer.Contains("face")).SelectRandom(random);

            AddLayerOrDefault(sprite, random, "body", skinPalette);
            AddLayerOrDefault(sprite, random, "face", skinPalette);
            AddLayerOrDefault(sprite, random, "nose", skinPalette);
            AddLayerOrDefault(sprite, random, "beard", hairPalette);
            AddLayerOrDefault(sprite, random, "hair", hairPalette);
            AddLayerOrDefault(sprite, random, "tool");
            AddLayerOrDefault(sprite, random, "hat", hairPalette);

            sprite.SetAnimations(Library.LoadNewLayeredAnimationFormat(ContentPaths.dwarf_animations));

            sprite.SetFlag(Flag.ShouldSerialize, false);
        }
Exemple #2
0
 public int GetSpeciesPopulation(CreatureClass Class)
 {
     if (!SpeciesCounts.ContainsKey(Class.Name))
     {
         return(0);
     }
     return(SpeciesCounts[Class.Name]);
 }
Exemple #3
0
        public void AddToSpeciesTracking(CreatureClass Class)
        {
            if (!SpeciesCounts.ContainsKey(Class.Name))
            {
                SpeciesCounts.Add(Class.Name, 0);
            }

            SpeciesCounts[Class.Name] += 1;
        }
Exemple #4
0
 public void RemoveFromSpeciesTracking(CreatureClass Class)
 {
     if (!SpeciesCounts.ContainsKey(Class.Name))
     {
         SpeciesCounts.Add(Class.Name, 0);
     }
     else
     {
         SpeciesCounts[Class.Name] += 1;
     }
 }
Exemple #5
0
        protected void CreateDwarfSprite(CreatureClass employeeClass, ComponentManager manager)
        {
            if (Physics == null)
            {
                if (GetRoot().GetComponent <Physics>().HasValue(out var physics))
                {
                    Physics = physics;
                }
                else
                {
                    return;
                }
            }

            Physics.AddChild(DwarfSprites.DwarfBuilder.CreateDwarfCharacterSprite(manager, Stats));
        }