本文整理匯總了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);
}
}