Ejemplo n.º 1
0
 public AnimationPlayer GetAnimationPlayer(LayeredSprites.LayerStack stack)
 {
     foreach (Animation animation in AnimationLibrary.LoadNewLayeredAnimationFormat(ContentPaths.dwarf_animations))
     {
         if (animation.Name == "IdleFORWARD")
         {
             return(new AnimationPlayer(stack.ProxyAnimation(animation)));
         }
     }
     return(null);
 }
Ejemplo n.º 2
0
        protected void CreateDwarfSprite(EmployeeClass employeeClass, ComponentManager manager)
        {
            if (Physics == null)
            {
                Physics = GetRoot().GetComponent <Physics>();
                if (Physics == null)
                {
                    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);

            AttackMode = Stats.CurrentClass.AttackMode;

            foreach (Animation animation in AnimationLibrary.LoadNewLayeredAnimationFormat(ContentPaths.dwarf_animations))
            {
                sprite.AddAnimation(animation);
            }

            sprite.SetCurrentAnimation(Sprite.Animations.First().Value);
            sprite.SetFlag(Flag.ShouldSerialize, false);
        }