ready for logan?
getting ready to piece UI elements together with the logic of the grid
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user