本文整理汇总了C#中Substrate.ChunkRef.GetWestNeighbor方法的典型用法代码示例。如果您正苦于以下问题:C# ChunkRef.GetWestNeighbor方法的具体用法?C# ChunkRef.GetWestNeighbor怎么用?C# ChunkRef.GetWestNeighbor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Substrate.ChunkRef
的用法示例。
在下文中一共展示了ChunkRef.GetWestNeighbor方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetNeighborBlock
private AlphaBlockRef GetNeighborBlock(ChunkRef chunk, int x, int y, int z)
{
if (chunk == null)
return new AlphaBlockRef();
ChunkRef target = chunk;
if (x < 0) {
target = chunk.GetNorthNeighbor();
x += chunk.Blocks.XDim;
}
else if (x >= chunk.Blocks.XDim) {
target = chunk.GetSouthNeighbor();
x -= chunk.Blocks.XDim;
}
else if (z < 0) {
target = chunk.GetEastNeighbor();
z += chunk.Blocks.ZDim;
}
else if (z >= chunk.Blocks.ZDim) {
target = chunk.GetWestNeighbor();
z -= chunk.Blocks.ZDim;
}
else
return target.Blocks.GetBlockRef(x, y, z);
return GetNeighborBlock(target, x, y, z);
}