public IMap <int> GenerateTerrainMap(IWorldRules worldConfig, Vector size) { Contract.Requires(worldConfig != null); int terrainId = worldConfig.Terrains[this.terrain]; int[,] tiles = new int[size.X, size.Y]; for (int x = 0; x < size.X; x++) { for (int y = 0; y < size.Y; y++) { tiles[x, y] = terrainId; } } return(new ArrayMap <int>(tiles)); }
public IMap <int> GenerateTerrainMap(IWorldRules worldConfig, Vector size) { Contract.Requires(worldConfig != null); int land = worldConfig.Terrains[Terrains.Land]; int water = worldConfig.Terrains[Terrains.Water]; float[,] noiseMap = new float[size.X, size.Y]; this.noiseGenerator.Generate(noiseMap); int[,] tiles = new int[size.X, size.Y]; for (int x = 0; x < size.X; ++x) { for (int y = 0; y < size.Y; ++y) { tiles[x, y] = noiseMap[x, y] > this.waterThreshold ? land : water; } } return(new ArrayMap <int>(tiles)); }