void Start() { if (debug) { Debug.Log("Starting map generation..."); } waveSpawner = hostileSpawner.GetComponent <WaveSpawner> (); chunkHolder.transform.position = new Vector3(-chunkDiameter / 2, 0, -chunkDiameter / 2); seedGen = new System.Random(); biomeNoiseInterval = 1 / biomeList.Count; biomeNoiseTopRange = new float[biomeList.Count]; for (int i = 0; i < biomeList.Count; i++) { biomeNoiseTopRange [i] = biomeNoiseInterval + biomeNoiseInterval * i; } biomePrefabs = biomeList [seedGen.Next(0, biomeList.Count)]; if (biomePrefabs != null) { GenerateMap(); perlinSeed = seedGen.Next(arrDimensions); GenerateChunk(0, 0); chunkHolder.GetComponent <ChunkHolder> ().UpdateChunksAroundPlayer(2); } }
void Start() { if (debug) { Debug.Log("Starting map generation..."); } waveSpawner = hostileSpawner.GetComponent <WaveSpawner> (); chunkHolder.transform.position = new Vector3(-chunkDiameter / 2, 0, -chunkDiameter / 2); biomePrefabs = biome.GetComponent <BiomePrefabs> (); seedGen = new System.Random(); if (biomePrefabs != null) { GenerateMap(); GenerateChunk(0, 0); chunkHolder.GetComponent <ChunkHolder> ().UpdateChunksAroundPlayer(2); } }
void SelectBiome(float perlinNoise) { for (int i = 0; i < biomeList.Count; i++) { if (perlinNoise < biomeNoiseTopRange [i]) { biomePrefabs = biomeList [i]; return; } } if (perlinNoise > 0.5) { biomePrefabs = biomeList [0]; } else { biomePrefabs = biomeList [1]; } }