/// <summary> /// Loads a mixed tile type from the XML element into the given tileset. /// </summary> /// <param name="fromElem">The XML element to load from.</param> /// <param name="tileset">The TileSet to load to.</param> private static void LoadMixedTile(XElement fromElem, TileSet tileset) { XAttribute terrainAAttr = fromElem.Attribute(XmlTileSetConstants.MIXEDTILE_TERRAINA_ATTR); XAttribute terrainBAttr = fromElem.Attribute(XmlTileSetConstants.MIXEDTILE_TERRAINB_ATTR); XAttribute combinationAttr = fromElem.Attribute(XmlTileSetConstants.MIXEDTILE_COMBINATION_ATTR); if (terrainAAttr == null) { throw new TileSetException("Terrain type A not defined for mixed tile!"); } if (terrainBAttr == null) { throw new TileSetException("Terrain type B not defined for mixed tile!"); } if (combinationAttr == null) { throw new TileSetException("Terrain combination not defined for mixed tile!"); } TerrainCombination combination; if (!EnumMap <TerrainCombination, string> .TryDemap(combinationAttr.Value, out combination)) { throw new TileSetException(string.Format("Unexpected terrain combination '{0}' defined for mixed tile.", combinationAttr.Value)); } tileset.CreateMixedTileType(terrainAAttr.Value, terrainBAttr.Value, combination); IsoTileType tile = tileset.GetIsoTileTypeImpl(terrainAAttr.Value, terrainBAttr.Value, combination); LoadVariants(fromElem, tile, tileset); }
/// <summary> /// Loads a simple tile type from the XML element into the given tileset. /// </summary> /// <param name="fromElem">The XML element to load from.</param> /// <param name="tileset">The TileSet to load to.</param> private static void LoadSimpleTile(XElement fromElem, TileSet tileset) { XAttribute terrainAttr = fromElem.Attribute(XmlTileSetConstants.SIMPLETILE_TERRAIN_ATTR); if (terrainAttr == null) { throw new TileSetException("Terrain type not defined for simple tile!"); } tileset.CreateSimpleTileType(terrainAttr.Value); IsoTileType tile = tileset.GetIsoTileTypeImpl(terrainAttr.Value); LoadVariants(fromElem, tile, tileset); }