Ejemplo n.º 1
0
    private void PlaceWallNear(Vector2 point)
    {
        int[]   gridCoord = grid.GetGridPos(point);
        Vector2 worldPos  = grid.GetWorldPos(gridCoord);

        if (!grid.IsWall(gridCoord))
        {
            GameObject w = GameObject.Instantiate(wall);
            w.transform.position   = worldPos;
            w.transform.localScale = new Vector3(cell_size, cell_size, 1f);
            w.transform.SetParent(map.transform);

            grid.CreateWall(gridCoord);
        }
    }