private void createLandSea() { PerlinHelper ph = new PerlinHelper(mapWidth, mapHeight, perlinScale); for (int y = 0; y < mapHeight; y++) { for (int x = 0; x < mapWidth; x++) { if (ph[x, y] >= landCutoff) { map[x, y] = 1; } else { map[x, y] = 0; } } } }
private void createCity(Room c) { PerlinHelper ph = new PerlinHelper(c.width, c.height, cityPerlinScale); for (int x = 0; x < c.width; x++) { for (int y = 0; y < c.height; y++) { int tile; Vector2 centerDist = new Vector2(Mathf.Abs(x - c.width / 2), Mathf.Abs(y - c.height / 2)); if (centerDist.magnitude <= 2) { tile = 3; } else { float result = ph[x, y] - (centerDist.magnitude / c.radius); if (result >= cityLandCutoff) { tile = 1; } else { tile = 2; } } if (tile != 2 || cityDebug) { map[c.x + x, c.y + y] = tile; } } } }