summaryrefslogtreecommitdiff
path: root/Pathfinding Visualizer/Assets/Scripts/Main.cs
diff options
context:
space:
mode:
authorSimon O'Shea <osheas1@wit.edu>2023-08-08 12:31:23 -0400
committerSimon O'Shea <osheas1@wit.edu>2023-08-08 12:31:23 -0400
commitfe38db5f3786e1103b6da78925b2b688e4cd6065 (patch)
tree9fb577e0832956ba644ef23181857447254dfbb3 /Pathfinding Visualizer/Assets/Scripts/Main.cs
parent7c3fd8d5630482d96dbbfbed2cd08c0d3530d5ad (diff)
ready for logan?
getting ready to piece UI elements together with the logic of the grid
Diffstat (limited to 'Pathfinding Visualizer/Assets/Scripts/Main.cs')
-rw-r--r--Pathfinding Visualizer/Assets/Scripts/Main.cs56
1 files changed, 39 insertions, 17 deletions
diff --git a/Pathfinding Visualizer/Assets/Scripts/Main.cs b/Pathfinding Visualizer/Assets/Scripts/Main.cs
index cdc64db..fcac001 100644
--- a/Pathfinding Visualizer/Assets/Scripts/Main.cs
+++ b/Pathfinding Visualizer/Assets/Scripts/Main.cs
@@ -16,10 +16,10 @@ public class Main : MonoBehaviour
void Start()
{
// Create world
- world = new LogicGrid(5, 5, 10f, new Vector3(0, 0));
+ world = new LogicGrid(100, 100, 5f, new Vector3(-110, -110));
// Set default placement to Obstacle
- placementValue = -1;
+ placementValue = 1;
placementMode = 'o';
cellMesh.SetGrid(world);
@@ -32,38 +32,43 @@ public class Main : MonoBehaviour
void Update()
{
// Change Placement Modes:
- // Place Agent in grid
- // TODO change modes via UI button
- if(Input.GetKeyDown("a"))
+
+ // Place Obstacle in grid
+ if (Input.GetKeyDown("o"))
{
- Debug.Log("Placing Mode: Agent");
- placementMode = 'a';
- placementValue = 3;
+ Debug.Log("Placing Mode: Obstacle");
+ placementMode = 'o';
+ placementValue = 1;
}
- // Place Sample in grid
+ // Place Sample in cell
if(Input.GetKeyDown("s"))
{
Debug.Log("Placing Mode: Sample");
placementMode = 's';
placementValue = 2;
}
- // Place Obstacle in grid
- if(Input.GetKeyDown("o"))
+ // Place agent in cell
+ if (Input.GetKeyDown("a"))
{
- Debug.Log("Placing Mode: Obstacle");
- placementMode = 'o';
- placementValue = 1;
+ Debug.Log("Placing Mode: Agent");
+ placementMode = 'a';
+ placementValue = 3;
}
+ // Reset Canvas
+ if (Input.GetKeyDown("r"))
+ {
+
+ }
+
-
// Update Cell:
// Change cell to obstacle
- if (Input.GetMouseButtonDown(0))
+ if (Input.GetMouseButton(0))
{
world.SetValue(CodeMonkey.Utils.UtilsClass.GetMouseWorldPosition(), placementValue);
}
// Clear cell
- if (Input.GetMouseButtonDown(1))
+ if (Input.GetMouseButton(1))
{
world.SetValue(CodeMonkey.Utils.UtilsClass.GetMouseWorldPosition(), 0);
}
@@ -73,4 +78,21 @@ public class Main : MonoBehaviour
// and perform the selected algorithm
}
+
+
+ public void SetModeObstacle()
+ {
+ placementValue = 1;
+ }
+ public void SetModeSample()
+ {
+ placementValue = 2;
+ }
+
+ public void SetModeAgent()
+ {
+ placementValue = 3;
+ }
+
+
}