public async Task PlaceInCave(int caveIndex) { await GenerateNearbyChunksAsync(DestinationChunkCoordinate); CaveChunk destinationChunk = await ChunkManager.CreateChunkAsync(DestinationChunkCoordinate); await PlaceInCave(destinationChunk.CellData.Hollows[caveIndex]); }
public int ChunkGenerationRadius; //TODO merge with PlayerChunkTracker public async Task PlaceInRandomCave() { await GenerateNearbyChunksAsync(DestinationChunkCoordinate); CaveChunk destinationChunk = await ChunkManager.CreateChunkAsync(DestinationChunkCoordinate); int randomCaveIndex = Random.Range(0, destinationChunk.CellData.Hollows.Count - 1); await PlaceInCave(destinationChunk.CellData.Hollows[randomCaveIndex]); }
public void Generate(WallGroup wall, CaveChunk chunk) { _wall = wall; Chunk = chunk; SetMeshGenerator(); _data = GenerateMeshData(out Vector3Int minCoordinate); MinCoordinate = minCoordinate; }
public async Task PlaceInCave(HollowGroup cave) //TODO different placements { Vector3Int lowestPointChunkPosition = cave.GetLowestPoint(); await GenerateNearbyChunksAsync(DestinationChunkCoordinate); CaveChunk destinationChunk = await ChunkManager.CreateChunkAsync(DestinationChunkCoordinate); Vector3 offsetPosition = (Vector3)ChunkManager.MeshSettings.GridSize / 2.0f; Vector3 position = destinationChunk.GetWorldPosition(lowestPointChunkPosition) + offsetPosition; transform.position = position; }