本文整理汇总了C#中Chunk.GetBlockRelativePosition方法的典型用法代码示例。如果您正苦于以下问题:C# Chunk.GetBlockRelativePosition方法的具体用法?C# Chunk.GetBlockRelativePosition怎么用?C# Chunk.GetBlockRelativePosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Chunk
的用法示例。
在下文中一共展示了Chunk.GetBlockRelativePosition方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ConstructBlock
public void ConstructBlock(int x, int y, int z, Chunk chunk)
{
if (!(chunk.TopChunk == null && y == Chunk.chunkSize - 1) && chunk.GetBlockRelativePosition(x, y + 1, z) == null)
{
//Block above is air
CreateTopFace(x, y, z, chunk);
}
if (!(chunk.BottomChunk == null && y == 0) && chunk.GetBlockRelativePosition(x, y - 1, z) == null)
{
//Block below is air
CreateBottomFace(x, y, z, chunk);
}
if (!(chunk.RightChunk == null && x == Chunk.chunkSize - 1) && chunk.GetBlockRelativePosition(x + 1, y, z) == null)
{
//Block east is air
CreateRightFace(x, y, z, chunk);
}
if (!(chunk.LeftChunk == null && x == 0) && chunk.GetBlockRelativePosition(x - 1, y, z) == null)
{
//Block west is air
CreateLeftFace(x, y, z, chunk);
}
if (!(chunk.ForwardChunk == null && z == Chunk.chunkSize - 1) && chunk.GetBlockRelativePosition(x, y, z + 1) == null)
{
//Block north is air
CreateForwardFace(x, y, z, chunk);
}
if (!(chunk.BehindChunk == null && z == 0) && chunk.GetBlockRelativePosition(x, y, z - 1) == null)
{
//Block south is air
CreateBehindFace(x, y, z, chunk);
}
}