void CreateCell(int x, int z, int xs, int y, GridCell[,] cells) { Vector3 position; position.x = x * GridMetrics.squareSize + xs * maxMeshSize * GridMetrics.squareSize; position.y = 0f; position.z = z * GridMetrics.squareSize + y * maxMeshSize * GridMetrics.squareSize; GridCell cell = cells[x, z] = Instantiate <GridCell>(cellPrefab); cell.transform.SetParent(gridMeshes[xs, y].transform); cell.transform.position = position + transform.position; cell.color = colors[(int)Random.Range(0, colors.Length)]; cell.height = 0; cell.SetIndices(x, z, xs, y, maxMeshSize); }
void CreateCell(int x, int z, int xs, int y, GridCell[,] cells) { Noise noise = new Noise(); Vector3 position; position.x = x * GridMetrics.squareSize + xs * gridMap.maxMeshSize * GridMetrics.squareSize; position.y = gridMap.mapCells[gridMap.maxMeshSize * y + z].height[xs * gridMap.maxMeshSize + x]; position.z = z * GridMetrics.squareSize + y * gridMap.maxMeshSize * GridMetrics.squareSize; GridCell cell = cells[x, z] = Instantiate <GridCell>(cellPrefab); cell.transform.SetParent(gridMeshes[xs, y].transform); cell.transform.position = position + transform.position; cell.color = gridMap.mapCells[gridMap.maxMeshSize * y + z].color[xs * gridMap.maxMeshSize + x]; cell.height = gridMap.mapCells[gridMap.maxMeshSize * y + z].height[xs * gridMap.maxMeshSize + x]; cell.cellTemplate = gridMap.mapCells[gridMap.maxMeshSize * y + z].template[xs * gridMap.maxMeshSize + x]; cell.SetIndices(x, z, xs, y, gridMap.maxMeshSize); cell.SetCellState(); }