void GenerateTerrain() { int halfHeight = mapSize.y / 2; for (int x = 0; x < mapSize.x; x++) { for (int y = 0; y < mapSize.y; y++) { float density = halfHeight - y; density += Noise.CalcPixel1DFractal(x, 0.03f, 3) * 30.0f; float noise = Noise.CalcPixel2DFractal(x, y, 0.01f, 3); if (density > 0) { if (noise <= 0.3) { continue; } float randomLight = Noise.CalcPixel2D(x, y, 0.03f); if (randomLight >= 0.91f) { float randomType = Noise.CalcPixel2D(x, y, 0.01f); SetTile(new int2(x, y), tileInformations[(int)TileUtil.MinMaxNormalization(randomType, 0, 1, 3, 6)].id); } else { SetTile(new int2(x, y), tileInformations[1].id); } } } } }