Exemple #1
0
 private void ToggleCell(TileInteractionBehavior cell)
 {
     MainGrid.Designations.ToggleGridpoint(cell.X, cell.Y);
     foreach (GridCell item in cell.ConnectedCells)
     {
         item.ResetDesignationOptions();
     }
     solver = new VisualsSolution(MainGrid);
     DisplaySolve();
 }
Exemple #2
0
 private void HandleInteraction()
 {
     if (Input.GetMouseButtonUp(0))
     {
         Ray        mouseRay = Camera.main.ScreenPointToRay(Input.mousePosition);
         RaycastHit hitInfo;
         if (Physics.Raycast(mouseRay, out hitInfo))
         {
             TileInteractionBehavior cell = hitInfo.collider.gameObject.GetComponent <TileInteractionBehavior>();
             ToggleCell(cell);
         }
     }
 }
Exemple #3
0
    private TileInteractionBehavior CreateInteractionTile(int x, int y)
    {
        GameObject obj = GameObject.CreatePrimitive(PrimitiveType.Quad);

        obj.name = x + " " + y;
        obj.transform.position = new Vector3(x, y, 0);
        Destroy(obj.GetComponent <MeshRenderer>());
        TileInteractionBehavior behavior = obj.AddComponent <TileInteractionBehavior>();

        behavior.X = x;
        behavior.Y = y;
        behavior.ConnectedCells = GetConnectedCells(x, y).ToArray();
        return(behavior);
    }
Exemple #4
0
    private List <TileInteractionBehavior> CreateInteractionTiles()
    {
        List <TileInteractionBehavior> ret = new List <TileInteractionBehavior>();
        GameObject tiles = new GameObject("InteractionTiles");

        for (int x = 0; x < Width + 1; x++)
        {
            for (int y = 0; y < Height + 1; y++)
            {
                TileInteractionBehavior obj = CreateInteractionTile(x, y);
                obj.transform.parent = tiles.transform;
                ret.Add(obj);
            }
        }
        tiles.transform.position = new Vector3(-(float)Width / 2, -(float)Height / 2);
        return(ret);
    }