本文整理汇总了C#中BlockPos.ContainingChunkCoordinates方法的典型用法代码示例。如果您正苦于以下问题:C# BlockPos.ContainingChunkCoordinates方法的具体用法?C# BlockPos.ContainingChunkCoordinates怎么用?C# BlockPos.ContainingChunkCoordinates使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BlockPos
的用法示例。
在下文中一共展示了BlockPos.ContainingChunkCoordinates方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetChunk
/// <summary>
/// Get's the chunk object at pos
/// </summary>
/// <param name="pos">Position of the chunk or of a block within the chunk</param>
/// <returns>chunk that contains the given block position or null if there is none</returns>
public Chunk GetChunk(BlockPos pos)
{
//Get the coordinates of the chunk containing this block
pos = pos.ContainingChunkCoordinates();
Chunk containerChunk = null;
chunks.TryGetValue(pos, out containerChunk);
return containerChunk;
}
示例2: UpdateAdjacentChunks
/// <summary>
/// Updates any chunks neighboring a block position
/// </summary>
/// <param name="pos">position of change</param>
public void UpdateAdjacentChunks(BlockPos pos)
{
BlockPos localPos = pos - pos.ContainingChunkCoordinates();
//Checks to see if the block position is on the border of the chunk
//and if so update the chunk it's touching
UpdateIfEqual(localPos.x, 0, pos.Add(-1, 0, 0));
UpdateIfEqual(localPos.x, Config.Env.ChunkSize - 1, pos.Add(1, 0, 0));
UpdateIfEqual(localPos.y, 0, pos.Add(0, -1, 0));
UpdateIfEqual(localPos.y, Config.Env.ChunkSize - 1, pos.Add(0, 1, 0));
UpdateIfEqual(localPos.z, 0, pos.Add(0, 0, -1));
UpdateIfEqual(localPos.z, Config.Env.ChunkSize - 1, pos.Add(0, 0, 1));
}
示例3: SaveCompleteForChunk
public void SaveCompleteForChunk(BlockPos pos)
{
chunksToSave.Remove(pos.ContainingChunkCoordinates());
progress = Mathf.FloorToInt(((totalChunksToSave - chunksToSave.Count) / ((float)totalChunksToSave)) * 100);
}