From ddc02784c24baf22903527871233f9b4db6745ed Mon Sep 17 00:00:00 2001 From: Simon O'Shea Date: Tue, 8 Aug 2023 17:17:45 -0400 Subject: pathfinding class now interprets grid properly can successfully read in the user-generated world! --- Pathfinding Visualizer/Assets/Scripts/Pathfinder.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'Pathfinding Visualizer/Assets/Scripts/Pathfinder.cs') diff --git a/Pathfinding Visualizer/Assets/Scripts/Pathfinder.cs b/Pathfinding Visualizer/Assets/Scripts/Pathfinder.cs index 6410626..eae7233 100644 --- a/Pathfinding Visualizer/Assets/Scripts/Pathfinder.cs +++ b/Pathfinding Visualizer/Assets/Scripts/Pathfinder.cs @@ -9,9 +9,9 @@ public class Pathfinder : MonoBehaviour public static List closed = new List(); LogicGrid world; - public static int[] agent; - public static List obstacles; - public static List samples; + public static Vector2Int agent; + public static List obstacles; + public static List samples; public static int algorithm; // 0 = A* | 1 = dfs | 2 = bfs public static int heuristic; // 0 = h0 | 1 = h1 | 2 = h2 @@ -20,7 +20,7 @@ public class Pathfinder : MonoBehaviour public static int width; - public Pathfinder(LogicGrid world, int[] a, List o, List s, int algo, int heu) + public Pathfinder(LogicGrid world, Vector2Int a, List o, List s, int algo, int heu) { this.world = world; height = world.GetHeight(); @@ -41,12 +41,12 @@ public class Pathfinder : MonoBehaviour for(int i = 0; i < obstacles.Count; i++) { - Debug.Log("Obstacle " + i + ": " + obstacles[i][0][0] + ", " + obstacles[i][0][1]); + Debug.Log("Obstacle " + i + ": " + obstacles[i].x + ", " + obstacles[i].y); } for (int i = 0; i < samples.Count; i++) { - Debug.Log("Sample " + i + ": " + samples[i][0][0] + ", " + samples[i][0][1]); + Debug.Log("Sample " + i + ": " + samples[i].x + ", " + samples[i].y); } } -- cgit v1.3.1-4-g156e