/// <summary> /// Constructor. The main thing done in this constructor is determining the reference tile used for calculating from 3D tile-based to effectively 2D without tiles. /// </summary> /// <param name="worldTiles">The object that know what tiles are in principle available, so a reference location can be chosen nicely in the middle</param> public Translate3Dto2D(DrawWorldTiles worldTiles) { int TileXmin = int.MaxValue; int TileXmax = int.MinValue; int TileZmin = int.MaxValue; int TileZmax = int.MinValue; worldTiles.DoForAllTiles(new TileDelegate((tileX, tileZ) => { if (tileX > TileXmax) { TileXmax = tileX; } if (tileX < TileXmin) { TileXmin = tileX; } if (tileZ > TileZmax) { TileZmax = tileZ; } if (tileZ < TileZmin) { TileZmin = tileZ; } })); referenceTileX = (TileXmax + TileXmin) / 2; referenceTileZ = (TileZmax + TileZmin) / 2; }
/// <summary> /// Constructor /// </summary> /// <param name="routePath">Path to the route directory</param> /// <param name="messageDelegate">The delegate that will present with the message we want to send to the user during long loading times</param> /// <param name="drawWorldTiles">The object that knows which tiles are available</param> public DrawTerrain(string routePath, MessageDelegate messageDelegate, DrawWorldTiles drawWorldTiles) { this.messageDelegate = messageDelegate; this.tilesPath = routePath + @"\TILES\"; this.lotilesPath = routePath + @"\LO_TILES\"; this.terrtexPath = routePath + @"\TERRTEX\"; locationTranslator = new Translate3Dto2D(drawWorldTiles); terrainTiles = new Dictionary <uint, TerrainTile2D>(); loadedTerrainTiles = new HashSet <uint>(); }