public TerrainTreesGenerator(TerrainConfig config, TerrainChunk chunk) { this.config = config; this.chunk = chunk; rand = new System.Random(chunk.Index.X * 10000 + chunk.Index.Z); }
public void Setup(Index3D chunkIndex, TerrainConfig terrainConfig) { Index = chunkIndex; config = terrainConfig; // We include two extra "invisible blocks" for each dimension (one at the beginning and other at the end). blocks = new TerrainBlock[ config.ChunkSizeInBlocks.x + 2, config.ChunkSizeInBlocks.y + 2, config.ChunkSizeInBlocks.z + 2 ]; firstBlockGlobalIndex = new Index3D( Index.X * config.ChunkSizeInBlocks.x - 1, Index.Y * config.ChunkSizeInBlocks.y - 1, Index.Z * config.ChunkSizeInBlocks.z - 1 ); }
private void Start() { terrainObject = new GameObject("Terrain") { isStatic = true }; config = GetComponent <TerrainConfig>(); var blocksGenerator = GetComponent <TerrainBlocksGenerator>(); chunksPool = GetComponent <TerrainChunksPool>(); chunkGenerator = new TerrainChunkGenerator(blocksGenerator, chunksPool, config); modifier = GetComponent <TerrainModifier>(); modifier.Setup(chunkGenerator, terrainObject.transform); UpdateTerrain() .ContinueWith(_ => Debug.Log("First load finished!")); }
public TerrainChunkMeshBuilder(TerrainConfig config) { this.config = config; }
private void Awake() { config = GetComponentInParent <TerrainConfig>(); }
private void Start() { config = GetComponent <TerrainConfig>(); rigidbodiesPool = GetComponent <ObjectsPool>(); }
public WaterMeshBuilder(TerrainConfig config) { this.config = config; }
public TerrainChunkGenerator(TerrainBlocksGenerator blocksGenerator, TerrainChunksPool chunksPool, TerrainConfig config) { this.blocksGenerator = blocksGenerator; this.chunksPool = chunksPool; this.config = config; }