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