Example #1
0
        public static AnimationAtlas BuildCharacter(string colorString)
        {
            var animation = new AnimationAtlas();
            var atlas     = XMLParser.ParseAtlasFile("Content/XMLDocuments/blob_Characters.xml");
            var textures  = new Dictionary <string, SubTexture>();

            foreach (var t in atlas.Textures)
            {
                textures.Add(t.Name, t);
            }

            AnimationSlide right = new AnimationSlide();

            right.AddTextureToSlide(textures[colorString + "_Right1"]);
            right.AddTextureToSlide(textures[colorString + "_Right2"]);
            right.AddTextureToSlide(textures[colorString + "_Right3"]);
            right.DefaultTexture = textures[colorString + "_Right1"];

            AnimationSlide left = new AnimationSlide();

            left.AddTextureToSlide(textures[colorString + "_Left1"]);
            left.AddTextureToSlide(textures[colorString + "_Left2"]);
            left.AddTextureToSlide(textures[colorString + "_Left3"]);
            left.DefaultTexture = textures[colorString + "_Left1"];

            animation.AddSlide("Right", right);
            animation.AddSlide("Left", left);
            animation.CurrentSlide = animation.Slides["Right"];

            return(animation);
        }
Example #2
0
        public void AddAnimation(string animName, int startFrame, int endFrame, int idle, string atlasName = null, int animationSpeed = 250)
        {
            AnimationAtlas cAtlas        = CurrentDefaultAtlas;
            bool           specificAtlas = false;

            if (atlasName != null)
            {
                cAtlas        = EntityAtlases[atlasName];
                specificAtlas = true;
            }
            AnimationTrack nAnimation = new AnimationTrack(this, cAtlas, startFrame, endFrame, idle);

            nAnimation.specificAtlas  = specificAtlas;
            nAnimation.AnimationSpeed = animationSpeed;
            EntityAnimationTracks.Add(animName, nAnimation);
        }
Example #3
0
        public void AddAtlas(string atlasName, Texture2D atlasTexture, int frames)
        {
            AnimationAtlas nAtlas = new AnimationAtlas(atlasTexture, frames, this);

            EntityAtlases.Add(atlasName, nAtlas);
        }