本文整理汇总了C#中IChunk.SetBiomeColumn方法的典型用法代码示例。如果您正苦于以下问题:C# IChunk.SetBiomeColumn方法的具体用法?C# IChunk.SetBiomeColumn怎么用?C# IChunk.SetBiomeColumn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IChunk
的用法示例。
在下文中一共展示了IChunk.SetBiomeColumn方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GenerateOuterLayer
private void GenerateOuterLayer(int x, int y, int z, int firstBlockHeight, BIOME_TYPE type, IChunk c)
{
double heightPercentage = (firstBlockHeight - y) / 128.0;
switch (type)
{
case BIOME_TYPE.PLAINS:
case BIOME_TYPE.MOUNTAINS:
// Beach
if (y >= 60 && y <= 66)
{
c.SetBiomeColumn(x, z, (byte)BIOME_TYPE.MOUNTAINS);
c.SetType(x, y, z, BlockData.Blocks.Sand, false);
break;
}
c.SetBiomeColumn(x, z, (byte)BIOME_TYPE.MOUNTAINS);
if (heightPercentage == 0.0 && y > 66)
{
// Grass on top
c.SetType(x, y, z, BlockData.Blocks.Grass, false);
}
else if (heightPercentage > 0.2)
{
// Stone
c.SetType(x, y, z, BlockData.Blocks.Stone, false);
}
else
{
// Dirt
c.SetType(x, y, z, BlockData.Blocks.Dirt, false);
}
GenerateRiver(c, x, y, z, heightPercentage, type);
break;
case BIOME_TYPE.SNOW:
c.SetBiomeColumn(x, z, (byte)BIOME_TYPE.SNOW);
if (heightPercentage == 0.0 && y > 65)
{
// Snow on top
c.SetType(x, y, z, BlockData.Blocks.Snow, false);
// Grass under the snow
c.SetType(x, y - 1, z, BlockData.Blocks.Grass, false);
}
else if (heightPercentage > 0.2)
// Stone
c.SetType(x, y, z, BlockData.Blocks.Stone, false);
else
// Dirt
c.SetType(x, y, z, BlockData.Blocks.Dirt, false);
GenerateRiver(c, x, y, z, heightPercentage, type);
break;
case BIOME_TYPE.DESERT:
c.SetBiomeColumn(x, z, (byte)BIOME_TYPE.DESERT);
/*if (heightPercentage > 0.6 && y < 75)
{
// Stone
data[x << 11 | z << 7 | y] = (byte)BlockData.Blocks.Stone;
}
else*/
if (y < 80)
c.SetType(x, y, z, BlockData.Blocks.Sand, false);
break;
}
}
示例2: GenerateTerrain
private void GenerateTerrain(IChunk c, int x, int z)
{
double[, ,] density = new double[17, 129, 17];
// Build the density map with lower resolution, 4*4*16 instead of 16*16*128
for (int bx = 0; bx <= 16; bx += 4)
{
int worldX = bx + (x * 16);
for (int bz = 0; bz <= 16; bz += 4)
{
BIOME_TYPE type = CalcBiomeType(x, z);
int worldZ = bz + (z * 16);
for (int by = 0; by <= 128; by += 8)
{
density[bx, by, bz] = CalcDensity(worldX, by, worldZ, type);
}
}
}
triLerpDensityMap(density);
for (int bx = 0; bx < 16; bx++)
{
int worldX = bx + (x * 16);
for (int bz = 0; bz < 16; bz++)
{
int worldZ = bz + (z * 16);
int firstBlockHeight = -1;
BIOME_TYPE type = CalcBiomeType(worldX, worldZ);
for (int by = 127; by >= 0; --by)
{
//int index = bx << 11 | bz << 7 | by;
if (by == 0) // First bedrock Layer
c.SetType(bx, by, bz, BlockData.Blocks.Bedrock, false);
else if (by > 0 && by < 5 && _FastRandom.randomDouble() > 0.3) // Randomly put blocks of the remaining 4 layers of bedrock
c.SetType(bx, by, bz, BlockData.Blocks.Bedrock, false);
else if (by <= 55)
c.SetType(bx, by, bz, BlockData.Blocks.Stone, false);
else
{
if (by > 55 && by < 64)
{
c.SetType(bx, by, bz, BlockData.Blocks.Still_Water, false);
if (by == 63 && type == BIOME_TYPE.SNOW)
{
c.SetBiomeColumn(bx, bz, (byte)BIOME_TYPE.SNOW);
c.SetType(bx, by, bz, BlockData.Blocks.Ice, false);
}
}
double dens = density[bx, by, bz];
if (dens >= 0.009 && dens <= 0.02)
{
// Some block was set...
if (firstBlockHeight == -1)
firstBlockHeight = by;
GenerateOuterLayer(bx, by, bz, firstBlockHeight, type, c);
}
else if (dens > 0.02)
{
// Some block was set...
if (firstBlockHeight == -1)
firstBlockHeight = by;
if (CalcCaveDensity(worldX, by, worldZ) > -0.6)
GenerateInnerLayer(bx, by, bz, type, c);
}
else
firstBlockHeight = -1;
}
if (c.GetType(bx, by, bz) == BlockData.Blocks.Stone)
GenerateResource(bx, by, bz, c);
}
}
}
}