protected override void InternalFromXml(System.Xml.Linq.XElement xml, TmxMap tmxMap) { // Get the tile uint gid = TmxHelper.GetAttributeAsUInt(xml, "gid"); this.FlippedHorizontal = TmxMath.IsTileFlippedHorizontally(gid); this.FlippedVertical = TmxMath.IsTileFlippedVertically(gid); uint rawTileId = TmxMath.GetTileIdWithoutFlags(gid); this.Tile = tmxMap.Tiles[rawTileId]; // The tile needs to have a mesh on it. // Note: The tile may already be referenced by another TmxObjectTile instance, and as such will have its mesh data already made if (this.Tile.Meshes.Count() == 0) { this.Tile.Meshes = TmxMesh.FromTmxTile(this.Tile, tmxMap); } // Check properties for layer placement if (this.Properties.PropertyMap.ContainsKey("unity:sortingLayerName")) { this.SortingLayerName = this.Properties.GetPropertyValueAsString("unity:sortingLayerName"); } if (this.Properties.PropertyMap.ContainsKey("unity:sortingOrder")) { this.SortingOrder = this.Properties.GetPropertyValueAsInt("unity:sortingOrder"); } }
protected override void InternalFromXml(XElement xml, TmxMap tmxMap) { uint attributeAsUInt = TmxHelper.GetAttributeAsUInt(xml, "gid"); FlippedHorizontal = TmxMath.IsTileFlippedHorizontally(attributeAsUInt); FlippedVertical = TmxMath.IsTileFlippedVertically(attributeAsUInt); uint tileIdWithoutFlags = TmxMath.GetTileIdWithoutFlags(attributeAsUInt); Tile = tmxMap.Tiles[tileIdWithoutFlags]; if (Tile.Meshes.Count() == 0) { Tile.Meshes = TmxMesh.FromTmxTile(Tile, tmxMap); } ExplicitSortingLayerName = base.Properties.GetPropertyValueAsString("unity:sortingLayerName", ""); if (base.Properties.PropertyMap.ContainsKey("unity:sortingOrder")) { ExplicitSortingOrder = base.Properties.GetPropertyValueAsInt("unity:sortingOrder"); } }