public World(WorldData worldData, ITerrainGenerator terrainGenerator, ILightProcessor lightProcessor, IMeshDataGenerator meshDataGenerator, IWorldDecorator worldDecorator, IChunkProcessor chunkProcessor) { m_WorldData = worldData; m_LightProcessor = lightProcessor; m_MeshDataGenerator = meshDataGenerator; m_WorldDecorator = worldDecorator; m_ChunkProcessor = chunkProcessor; m_TerrainGenerator = terrainGenerator; ContinueProcessingChunks = true; }
public World(WorldData worldData, ITerrainGenerator terrainGenerator, ILightProcessor lightProcessor, IMeshDataGenerator meshDataGenerator, IWorldDecorator worldDecorator, IChunkProcessor chunkProcessor) { m_WorldData = worldData; m_LightProcessor = lightProcessor; m_MeshDataGenerator = meshDataGenerator; m_WorldDecorator = worldDecorator; m_ChunkProcessor = chunkProcessor; m_TerrainGenerator = terrainGenerator; ContinueProcessingChunks = true; }
private void Start() { m_PrefabsByName = new Dictionary<string, Transform>(); InitializeDecoratorPrefabs(); m_ChunkProcessor = new ChunkProcessor(); m_WorldData = new WorldData(m_ChunkProcessor); m_ChunksParent = transform.FindChild("Chunks"); m_ChunkMover = new ChunkMover(m_WorldData, m_ChunkProcessor); // Only the dual layer terrain w/ medium valleys and standard terrain medium caves // currently work, I haven't updated the others to return sunlit blocks. BatchPoolProcessor<Chunk> batchProcessor = new BatchPoolProcessor<Chunk>(); WorldDecorator worldDecorator = new WorldDecorator(WorldData, batchProcessor); m_MeshDataGenerator = new MeshDataGenerator(batchProcessor, WorldData, m_ChunkProcessor); m_World = new World(WorldData, new TerrainGenerator(WorldData, m_ChunkProcessor, batchProcessor, new DualLayerTerrainWithMediumValleys()), new LightProcessor(batchProcessor, WorldData, m_ChunkProcessor), m_MeshDataGenerator, worldDecorator, m_ChunkProcessor); m_World.InitializeGridChunks(); InitializeTextures(); Player.transform.position = new Vector3(WorldData.WidthInBlocks / 2, 120, WorldData.HeightInBlocks / 2); CreateWorldChunkPrefabs(); m_World.StartProcessingThread(); m_PlayerChunkPosition = CurrentPlayerChunkPosition(); m_LastPlayerLocation = Player.position; }