void GenMap8() { Map2 map = new Map2(); map.Init(); new MapTexture2(TextureScale).DrawBiome(GameObject.Find("Map"), map); }
void GenMap6() { Map2 map = new Map2(); map.Init(); new MapTexture2(TextureScale).ShowRivers(GameObject.Find("Map"), map); }
private void GenMap4() { Map2 map = new Map2(); map.Init(); new MapTexture2(TextureScale).AttachTexture(GameObject.Find("Map"), map); }
private void GenMap5() { Map2 map = new Map2(); map.Init(); new MapTexture2(TextureScale).ShowElevation(GameObject.Find("Map"), map); }
public TileDetail[,,] Generate() { SurfaceGenerate mapGenerate = new SurfaceGenerate(); Map2 voronioMap = new Map2((float)width, (float)length); voronioMap.Init(); var terrain = ConvertToTerrain(voronioMap); TileDetail[,,] tileDetails = new TileDetail[width, height, length]; Map1 geologyMap = new Map1((float)width, (float)length, geologyPointCount); var geologyTerrain = ConvertToGeology(geologyMap, geologyRefinement); //土 IList <(Vector3 pos, float perlinNoise)> surfacePoints = mapGenerate.CreateSurfacePositions(width, length, refinement, offsetX, offsetY, multiplier); foreach (var v in surfacePoints) { if (terrain[(int)v.pos.x, (int)v.pos.z].tileType == eTileType.Ocean) { for (int i = 0; i < altitude; ++i) { tileDetails[(int)v.pos.x, i, (int)v.pos.z].tileType = eTileType.Ocean; } continue; } for (int i = 0; i < v.pos.y; ++i) { switch (geologyTerrain[(int)v.pos.x, (int)v.pos.z].geology) { case eGeology.None: tileDetails[(int)v.pos.x, i, (int)v.pos.z].tileType = eTileType.None; break; case eGeology.Grass: tileDetails[(int)v.pos.x, i, (int)v.pos.z].tileType = eTileType.Earth; break; case eGeology.Desert: tileDetails[(int)v.pos.x, i, (int)v.pos.z].tileType = eTileType.Sand; break; case eGeology.RockyMountain: tileDetails[(int)v.pos.x, i, (int)v.pos.z].tileType = eTileType.Stone; break; default: tileDetails[(int)v.pos.x, i, (int)v.pos.z].tileType = eTileType.Earth; break; } } } //水 for (int i = 0; i < width; ++i) { for (int k = 0; k < length; ++k) { if (tileDetails[i, altitude - 1, k].tileType == eTileType.None) { for (int j = altitude - 1; j >= 0; --j) { if (tileDetails[i, j, k].tileType == eTileType.None) { tileDetails[i, j, k].tileType = eTileType.Lake; } } } } } //種樹 IList <(Vector3 pos, float perlinNoise)> trees = mapGenerate.CreateSurfacePositions(width, length, treeRefinement, offsetX, offsetY, 1, treeWeights); foreach (var tree in trees) { for (int i = 0; i < height; ++i) { if (tileDetails[(int)tree.pos.x, i, (int)tree.pos.z].tileType == eTileType.None && i > 0 && tileDetails[(int)tree.pos.x, i - 1, (int)tree.pos.z].tileType == eTileType.Earth) { tileDetails[(int)tree.pos.x, i, (int)tree.pos.z].tileType = eTileType.Tree; break; } } } return(tileDetails); }