public Overworld.MapData[,] CreateMap() { int sx = Biomes.GetLength(0); int sy = Biomes.GetLength(1); Overworld.MapData[,] toReturn = new Overworld.MapData[Biomes.GetLength(0), Biomes.GetLength(1)]; for (int x = 0; x < sx; x++) { for (int y = 0; y < sy; y++) { toReturn[x, y] = new Overworld.MapData { Biome = (Overworld.Biome)Biomes[x, y], Erosion = Erosion[x, y], Faults = Faults[x, y], Height = Height[x, y], Rainfall = Rainfall[x, y], Temperature = Temperature[x, y], Water = (Overworld.WaterType)(Water[x, y]), Weathering = Weathering[x, y] }; } } return(toReturn); }
public Biomes[,] LoadMapFromFile(string path) { Biomes[,] map = new Biomes[320, 160]; using (var s = System.IO.File.Open(path, System.IO.FileMode.Open)) using (var b = new System.IO.BinaryReader(s)) { var width = map.GetLength(0); var height = map.GetLength(1); for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { map[x, y] = (Biomes)b.ReadInt32(); } } } return(map); }