public void generatePath(int startX, int startY, int targetX, int targetY) { if ((startX + startY + targetX + targetY) == 0) { pathfinder = new Pathfinder(hazardModel.getHazardModel() , hazardModel.hazardModelImage, 0, 0, r.Next(hazardModel.getHazardModel().GetLength(0)), r.Next(hazardModel.getHazardModel().GetLength(1))); } else { try { pathfinder = new Pathfinder(hazardModel.getHazardModel(), hazardModel.hazardModelImage, startX, startY, targetX, targetY); } catch (Exception) { } } }
public void startSimulationKnownMap(int startX, int startY, int endX, int endY) { Pathfinder pathfinder = new Pathfinder(hazardModel.getHazardModel() , hazardModel.hazardModelImage, startX, startY, endX, endY); System.Diagnostics.Stopwatch sw = System.Diagnostics.Stopwatch.StartNew(); pathfinder.findPath(startX, startY, endX, endY); sw.Stop(); pathfinder.generatePathImage(); steps = pathfinder.getPath().Count; imageSource = pathfinder.getPathImage(); timeTaken = sw.Elapsed.TotalSeconds + " Seconds"; stepTraverseStarted = false; }