public TerrainTreesGenerator(TerrainConfig config, TerrainChunk chunk)
        {
            this.config = config;
            this.chunk  = chunk;

            rand = new System.Random(chunk.Index.X * 10000 + chunk.Index.Z);
        }
Пример #2
0
        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
                );
        }
Пример #3
0
        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!"));
        }
Пример #4
0
 public TerrainChunkMeshBuilder(TerrainConfig config)
 {
     this.config = config;
 }
Пример #5
0
 private void Awake()
 {
     config = GetComponentInParent <TerrainConfig>();
 }
Пример #6
0
 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;
 }