diff options
| author | Simon O'Shea <osheas1@wit.edu> | 2023-08-08 15:27:37 -0400 |
|---|---|---|
| committer | Simon O'Shea <osheas1@wit.edu> | 2023-08-08 15:27:37 -0400 |
| commit | 3ac2b11494bd372d77465c97dc925ab28d87d8dc (patch) | |
| tree | 2c1d89041c58d4a5c5aee18f5a32f9d9a6903936 /Pathfinding Visualizer/Assets/Scripts/Main.cs | |
| parent | f825ec9c278af326bde56524a08888d067b2a68f (diff) | |
imported and translated java code
starting to implement algorithms
Diffstat (limited to 'Pathfinding Visualizer/Assets/Scripts/Main.cs')
| -rw-r--r-- | Pathfinding Visualizer/Assets/Scripts/Main.cs | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/Pathfinding Visualizer/Assets/Scripts/Main.cs b/Pathfinding Visualizer/Assets/Scripts/Main.cs index 018ce33..a146859 100644 --- a/Pathfinding Visualizer/Assets/Scripts/Main.cs +++ b/Pathfinding Visualizer/Assets/Scripts/Main.cs @@ -16,7 +16,12 @@ public class Main : MonoBehaviour void Start() { // Create world - world = new LogicGrid(100, 100, 5f, new Vector3(-110, -110)); + int width = 100; + int height = 100; + float cellSize = 5f; + Vector3 origin = new Vector3(-110, -110); + + world = new LogicGrid(width, height, cellSize, origin); // Set default placement to Obstacle placementValue = 1; @@ -28,11 +33,16 @@ public class Main : MonoBehaviour } - // Update is called once per frame - void Update() + public void StartAStar() { - // Change Placement Modes: + AStar astar = new AStar(world, 0); + } + // Update contains keyboard shortcut options + void Update() + { + // Change Placement Mode Keyboard Shortcuts: + //////////////////////////////// // Place Obstacle in grid if (Input.GetKeyDown("o")) { @@ -59,15 +69,16 @@ public class Main : MonoBehaviour { ResetGrid(); } - + ////////////////////////// + // Update Cell: - // Change cell to obstacle + // Place value in cell based on selected placementValue with left click if (Input.GetMouseButton(0)) { world.SetValue(CodeMonkey.Utils.UtilsClass.GetMouseWorldPosition(), placementValue); } - // Clear cell + // Clear cell with right click if (Input.GetMouseButton(1)) { world.SetValue(CodeMonkey.Utils.UtilsClass.GetMouseWorldPosition(), 0); @@ -79,7 +90,6 @@ public class Main : MonoBehaviour } - public void SetModeObstacle() { placementValue = 1; @@ -96,5 +106,5 @@ public class Main : MonoBehaviour { world.reset(); } - + } |
