Exemple #1
0
        public static TmxAnimation FromTileId(uint globalTileId)
        {
            TmxAnimation tmxAnimation = new TmxAnimation();
            TmxFrame     item         = TmxFrame.FromTileId(globalTileId);

            tmxAnimation.Frames.Add(item);
            return(tmxAnimation);
        }
Exemple #2
0
        // Returns an single frame animation
        public static TmxAnimation FromTileId(uint globalTileId)
        {
            TmxAnimation tmxAnimation = new TmxAnimation();

            TmxFrame tmxFrame = TmxFrame.FromTileId(globalTileId);
            tmxAnimation.Frames.Add(tmxFrame);

            return tmxAnimation;
        }
Exemple #3
0
 public TmxTile(uint globalId, uint localId, string tilesetName, TmxImage tmxImage)
 {
     this.GlobalId    = globalId;
     this.LocalId     = localId;
     this.TmxImage    = tmxImage;
     this.Properties  = new TmxProperties();
     this.ObjectGroup = new TmxObjectGroup();
     this.Animation   = TmxAnimation.FromTileId(globalId);
     this.Meshes      = new List <TmxMesh>();
 }
Exemple #4
0
 public TmxTile(TmxMap tmxMap, uint globalId, uint localId, string tilesetName, TmxImage tmxImage)
 {
     TmxMap      = TmxMap;
     GlobalId    = globalId;
     LocalId     = localId;
     TmxImage    = tmxImage;
     Properties  = new TmxProperties();
     ObjectGroup = new TmxObjectGroup(null, TmxMap);
     Animation   = TmxAnimation.FromTileId(globalId);
     Meshes      = new List <TmxMesh>();
 }
Exemple #5
0
        public static TmxAnimation FromXml(XElement xml, uint globalStartId)
        {
            TmxAnimation tmxAnimation = new TmxAnimation();

            foreach (XElement item in xml.Elements("frame"))
            {
                TmxFrame tmxFrame = TmxFrame.FromXml(item, globalStartId);
                tmxAnimation.Frames.Add(tmxFrame);
                tmxAnimation.TotalTimeMs += tmxFrame.DurationMs;
            }
            return(tmxAnimation);
        }
        public static TmxAnimation FromXml(XElement xml, uint globalStartId)
        {
            TmxAnimation tmxAnimation = new TmxAnimation();

            foreach (var xmlFrame in xml.Elements("frame"))
            {
                TmxFrame tmxFrame = TmxFrame.FromXml(xmlFrame, globalStartId);
                tmxAnimation.Frames.Add(tmxFrame);
            }

            return(tmxAnimation);
        }
        public static TmxAnimation FromXml(XElement xml, uint globalStartId)
        {
            TmxAnimation tmxAnimation = new TmxAnimation();

            foreach (var xmlFrame in xml.Elements("frame"))
            {
                TmxFrame tmxFrame = TmxFrame.FromXml(xmlFrame, globalStartId);
                tmxAnimation.Frames.Add(tmxFrame);
            }

            return tmxAnimation;
        }
Exemple #8
0
        public void ParseTileXml(XElement elem, TmxMap tmxMap, uint firstId)
        {
            Logger.WriteVerbose("Parse tile data (gid = {0}, id {1}) ...", GlobalId, LocalId);
            Properties = TmxProperties.FromXml(elem);
            XElement xElement = elem.Element("objectgroup");

            if (xElement != null)
            {
                ObjectGroup = TmxObjectGroup.FromXml(xElement, null, tmxMap);
                FixTileColliderObjects(tmxMap);
            }
            XElement xElement2 = elem.Element("animation");

            if (xElement2 != null)
            {
                Animation = TmxAnimation.FromXml(xElement2, firstId);
            }
        }
        public void ParseTileXml(XElement elem, TmxMap tmxMap, uint firstId)
        {
            Logger.WriteVerbose("Parse tile data (gid = {0}, id {1}) ...", this.GlobalId, this.LocalId);

            this.Properties = TmxProperties.FromXml(elem);

            // Do we have an object group for this tile?
            XElement elemObjectGroup = elem.Element("objectgroup");
            if (elemObjectGroup != null)
            {
                this.ObjectGroup = TmxObjectGroup.FromXml(elemObjectGroup, null, tmxMap);
                FixTileColliderObjects(tmxMap);
            }

            // Is this an animated tile?
            XElement elemAnimation = elem.Element("animation");
            if (elemAnimation != null)
            {
                this.Animation = TmxAnimation.FromXml(elemAnimation, firstId);
            }
        }