private void _smoothMap(System.Random rng, TerrainData data) { int width = data.Width; int height = data.Height; int[,] newData = new int[width,height]; for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { int filledCount = data.FilledNeighbors(x, y); if (filledCount > 4) { data.SetValue(x, y, 1); } else if(filledCount < 4) { data.SetValue(x, y, 0); } } } }