private void GenerateTree(int x, int y, int z) { GenerateLeaves(new Vector3i(x, y + 6, z), new Vector3i(x, y + 6, z)); for (int i = 0; i < 8; i++) { map.SetBlock(new OpenCog.Map.OCBlockData(wood, new Vector3i(x, y + i, z)), new Vector3i(x, y + i, z)); } }
private void GenerateTree(int x, int y, int z) { GenerateLeaves(new Vector3i(x, y + 6, z), new Vector3i(x, y + 6, z)); for (int i = 0; i < 8; i++) { map.SetBlock(OCBlockData.CreateInstance <OCBlockData>().Init(wood, new Vector3i(x, y + i, z)), new Vector3i(x, y + i, z)); } }
private bool GenerateChunk(Vector3i chunkPos) { bool reportedWater = false; bool reportedTerrain = false; bool reportedIsland = false; reportedWater = true; reportedTerrain = true; reportedIsland = true; bool generated = false; for (int z = -1; z < OpenCog.Map.OCChunk.SIZE_Z + 1; z++) { for (int x = -1; x < OpenCog.Map.OCChunk.SIZE_X + 1; x++) { for (int y = 0; y < OpenCog.Map.OCChunk.SIZE_Y; y++) { Vector3i worldPos = OpenCog.Map.OCChunk.ToWorldPosition(chunkPos, new Vector3i(x, y, z)); if (worldPos.y <= WATER_LEVEL) { if (map.GetBlock(worldPos).IsEmpty()) { map.SetBlock(water, worldPos); } if (!reportedWater) { Debug.Log("I made a water block!"); reportedWater = true; } generated = true; } int terrainHeight = GetTerrainHeight(worldPos.x, worldPos.z); if (worldPos.y <= terrainHeight) { GenerateBlockForBaseTerrain(worldPos); if (!reportedTerrain) { Debug.Log("I made a terrain block!"); reportedTerrain = true; } generated = true; continue; } int islandHeight = GetIslandHeight(worldPos.x, worldPos.z); if (worldPos.y <= islandHeight) { GenerateBlockForIsland(worldPos, islandHeight - worldPos.y, islandHeight); if (!reportedIsland) { Debug.Log("I made an island block!"); reportedIsland = true; } generated = true; continue; } } } } return(generated); }