Пример #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);
 }
Пример #2
0
 public AnimationPlayer GetAnimationPlayer(LayeredSprites.LayerStack stack, String Anim = "IdleFORWARD")
 {
     foreach (var animation in Library.LoadNewLayeredAnimationFormat(ContentPaths.dwarf_animations))
     {
         if (animation.Key == Anim)
         {
             return(new AnimationPlayer(stack.ProxyAnimation(animation.Value)));
         }
     }
     return(null);
 }
Пример #3
0
        private void AddLayerOrDefault(LayeredSprites.LayerStack stack, Random Random, String Layer, CreatureStats stats, LayeredSprites.Palette Palette = null)
        {
            var layers = LayeredSprites.LayerLibrary.EnumerateLayers(Layer).Where(l => !l.DefaultLayer && l.PassesFilter(stats));

            if (layers.Count() > 0)
            {
                stack.AddLayer(layers.SelectRandom(Random), Palette);
            }
            else
            {
                var defaultLayer = LayeredSprites.LayerLibrary.EnumerateLayers(Layer).Where(l => l.DefaultLayer).FirstOrDefault();
                if (defaultLayer != null)
                {
                    stack.AddLayer(defaultLayer, Palette);
                }
            }
        }
Пример #4
0
        public LayeredSprites.LayerStack GetLayers()
        {
            var random = new Random(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);

            LayeredSprites.LayerStack sprite = new LayeredSprites.LayerStack();
            CreatureStats             stats  = new CreatureStats(Class, Level.Index)
            {
                Gender = this.Gender
            };

            AddLayerOrDefault(sprite, random, "body", stats, skinPalette);
            AddLayerOrDefault(sprite, random, "face", stats, skinPalette);
            AddLayerOrDefault(sprite, random, "nose", stats, skinPalette);
            AddLayerOrDefault(sprite, random, "beard", stats, hairPalette);
            AddLayerOrDefault(sprite, random, "hair", stats, hairPalette);
            AddLayerOrDefault(sprite, random, "tool", stats);
            AddLayerOrDefault(sprite, random, "hat", stats, hairPalette);
            return(sprite);
        }
Пример #5
0
        private void AddLayerOrDefault(LayeredSprites.LayerStack stack, Random Random, String Layer, CreatureStats stats, LayeredSprites.Palette Palette = null)
        {
            var layers = LayeredSprites.LayerLibrary.EnumerateLayers(Layer).Where(l => !l.DefaultLayer && l.PassesFilter(stats));

            if (layers.Count() > 0)
            {
                var newLayer = layers.SelectRandom(Random);
                stack.AddLayer(newLayer, Palette);
                // Do not allow hats and hair on the same head.
                if (newLayer.Asset != "Entities/Dwarf/Layers/blank" && Layer == "hat")
                {
                    stack.RemoveLayer("hair");
                }
            }
            else
            {
                var defaultLayer = LayeredSprites.LayerLibrary.EnumerateLayers(Layer).Where(l => l.DefaultLayer).FirstOrDefault();
                if (defaultLayer != null)
                {
                    stack.AddLayer(defaultLayer, Palette);
                }
            }
        }
 public LayeredAnimationProxy(LayerStack Owner)
 {
     this.Owner = Owner;
 }