public List<Cube> CreateCubeField(Vector3 offset, Vector3 diagonal, float scale, float density) { List<Cube> cubes = new List<Cube>(); for (int i = 0; i < diagonal.x; i++) { for (int j = 0; j < diagonal.y; j++) { for (int k = 0; k < diagonal.z; k++) { if (Random.value < density) { Vector3 position = new Vector3(i*scale, j*scale, k*scale); Vector3 size = new Vector3(scale, scale, scale); Ocean cube = new Ocean(position, size); Color color = Util.RainbowColor(); cube.Color(color); cube.fluid.nutrients = Random.Range(10f, 100f); cubes.Add(cube); } } } } return cubes; }