void LoadNext() { var pos = this.ChunkQueue.Dequeue(); var chunk = WorldManager.Active.CreateChunk(pos); var g = SimplePool.Spawn(this.ChunkPrefab, Vector3.zero, Quaternion.identity); g.transform.SetParent(this.WorldTransform); g.GetComponent <ChunkRenderer>().Chunk = chunk; chunk.Dirty = true; this.CurrActive--; }
void OnGUI() { if (GUI.Button(new Rect(10, 10, 100, 25), "Rebuild Chunks")) { var seed = Random.Range(1, 1000000); WorldManager.Active.SetSeed(seed); Debug.Log(seed); foreach (var chunk in WorldManager.Active._chunks) { WorldManager.Active.TerrainGenerator.Generate(chunk.Value); chunk.Value.Dirty = true; } } if (GUI.Button(new Rect(10, 40, 100, 25), "Add Chunk")) { var g = SimplePool.Spawn(this.ChunkGameObject, Vector3.zero, Quaternion.identity); //g.GetComponent<ChunkRenderer>().chunkPosition = new Vector3Int(0, -testY++, 0); //ChunkPool.Create(new Vector3Int(0, -testY++, 0)); } }