本文整理汇总了C#中Chunk.SetBlockLight方法的典型用法代码示例。如果您正苦于以下问题:C# Chunk.SetBlockLight方法的具体用法?C# Chunk.SetBlockLight怎么用?C# Chunk.SetBlockLight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Chunk
的用法示例。
在下文中一共展示了Chunk.SetBlockLight方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LightSunlitBlocksInChunk
/// <summary>
/// This pass marks all blocks as sunlit that are open to sunlight directly above.
/// </summary>
/// <param name="chunk"></param>
private void LightSunlitBlocksInChunk(Chunk chunk)
{
byte sunlight = m_WorldData.ShadesOfLight[0];
for (int x = 0; x < m_WorldData.ChunkBlockWidth; x++)
{
for (int y = 0; y < m_WorldData.ChunkBlockHeight; y++)
{
for (int z = m_WorldData.ChunkBlockDepth -1; z >=0; z--)
{
// Starting at the top of the chunk, work our way down marking
// blocks as sunlit until we hit the bottom, or find a block.
Block block = chunk.GetBlock(x, y, z);
if (block.Type != BlockType.Air)
{
break;
}
chunk.SetBlockLight(x, y, z, sunlight);
}
}
}
}