public void BuildGrid() { curStartCube = null; curEndCube = null; cubes = new CubeBFS[width, height]; var colorDefault = colorPicker.GetObstacleColor(); foreach (var cube in instantiatedCubes) { if (cube.type == CubeBFS.Type.Obstacle) { cube.SetObstacle(colorDefault); cube.transform.localScale += new Vector3(0, 1, 0); } cubes[cube.x, cube.y] = cube; } //var cubesList = cubes.Cast<CubeBFS>().ToList(); SetStartCube(cubes[1, 18]); SetEndCube(cubes[18, 1]); }
public void SetEndCube(CubeBFS cube) { curEndCube = cube; var render = curEndCube.GetComponent <Renderer>(); render.material.color = colorPicker.GetEndColor(); }