public void RenderPath() { pathLayer.canvasImage.Width = grid.width; pathLayer.canvasImage.Height = grid.height; pathLayer.image = new Image <Rgba32>(grid.resolutionX, grid.resolutionY); foreach (Vector2Int pixel in pathfinding.path) { pathLayer.image[pixel.x, pixel.y] = new Rgba32(60, 60, 255); } pathLayer.UpdateImage(); }
public void RenderGrid() { gridLayer.canvasImage.Width = grid.width; gridLayer.canvasImage.Height = grid.height; gridLayer.image = new Image <Rgba32>(grid.resolutionX, grid.resolutionY); for (int x = 0; x <= grid.resolutionX - 1; x++) { for (int y = 0; y <= grid.resolutionY - 1; y++) { if (grid.GetPixel(x, y) == true) { gridLayer.image[x, y] = new Rgba32(100, 250, 100, 255); } else { gridLayer.image[x, y] = new Rgba32(0, 0, 0, 0); } } } gridLayer.UpdateImage(); }