예제 #1
0
 public void CopyState(Spritesheet <T> other)
 {
     AnimationFrame = other.AnimationFrame;
     Playing        = other.Playing;
     Finished       = other.Finished;
     CurrentAnimID  = other.CurrentAnimID;
     Rate           = other.Rate;
     currentFrame   = other.currentFrame;
     currentAnim    = other.currentAnim;
     timer          = other.timer;
 }
예제 #2
0
        public Spritesheet <int> GetSpriteInt(string id)
        {
            XmlElement xml = sprites[id];

            Spritesheet <int> sprite = new Spritesheet <int>(atlas[xml.ChildText("Texture")], xml.ChildInt("FrameWidth"), xml.ChildInt("FrameHeight"));

            sprite.Origin   = new Vector2(xml.ChildFloat("OriginX", 0), xml.ChildFloat("OriginY", 0));
            sprite.Position = new Vector2(xml.ChildFloat("X", 0), xml.ChildFloat("Y", 0));
            sprite.Color    = xml.ChildHexColor("Color", Color.White);

            XmlElement anims = xml["Animations"];

            if (anims != null)
            {
                foreach (XmlElement anim in anims.GetElementsByTagName("Anim"))
                {
                    sprite.Add(anim.AttrInt("id"), anim.AttrFloat("delay", 0), anim.AttrBool("loop", true), Calc.ReadCSVInt(anim.Attr("frames")));
                }
            }

            return(sprite);
        }