public void CrossingTest() { MpqManager.Initialize("S:\\WoW"); byte[] dataA, dataB; // Build tile A { var builder = new TileBuilder("Azeroth", 31, 49); dataA = builder.Build(new ConsoleLog()); Assert.IsNotNull(dataA); } // Build tile B { var builder = new TileBuilder("Azeroth", 32, 49); dataB = builder.Build(new ConsoleLog()); Assert.IsNotNull(dataB); } // Load into mesh var pather = new Pather("Azeroth"); Assert.IsTrue(pather.LoadTile(dataA)); Assert.IsTrue(pather.LoadTile(dataB)); // and try pathing, coords from AzerothMeshTest -> TileCrossing which is a non-building version of this var start = new Vector3(-9467.8f, 64.2f, 55.9f); var end = new Vector3(-9248.9f, -93.35f, 70.3f); var path = pather.FindPath(start, end); // check result Assert.IsNotNull(path); Assert.Greater(path.Count, 0); Assert.Less((end - path[path.Count - 1].Location).Length(), 3f); }
private void button4_Click(object sender, System.Windows.RoutedEventArgs e) { if (_pather == null) { return; } progressBar1.Maximum = 100; progressBar1.Value = 0; for (int y = OriginTileY; y <= OriginTileY + 2; y++) { for (int x = OriginTileX; x <= OriginTileX + 2; x++) { _pather.LoadTile(x, y); } } progressBar1.Value = 30; if (UseCircleTool) { markedLabel.Content = MarkMeshEllipses(PolyArea.Road); } else { markedLabel.Content = MarkMesh(PolyArea.Road); } progressBar1.Value = 60; for (int y = OriginTileY; y <= OriginTileY + 2; y++) { for (int x = OriginTileX; x <= OriginTileX + 2; x++) { byte[] data; if (_pather.RemoveTile(x, y, out data) && data != null) { File.WriteAllBytes(_pather.GetTilePath(x, y), data); } } } progressBar1.Value = 100; }