當前位置: 首頁>>代碼示例>>C#>>正文


C# BlockPos.ContainingChunkCoordinates方法代碼示例

本文整理匯總了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;
    }
開發者ID:li5414,項目名稱:Voxelmetric,代碼行數:15,代碼來源:World.cs

示例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));
 }
開發者ID:li5414,項目名稱:Voxelmetric,代碼行數:16,代碼來源:World.cs

示例3: SaveCompleteForChunk

 public void SaveCompleteForChunk(BlockPos pos)
 {
     chunksToSave.Remove(pos.ContainingChunkCoordinates());
     progress = Mathf.FloorToInt(((totalChunksToSave - chunksToSave.Count) / ((float)totalChunksToSave)) * 100);
 }
開發者ID:li5414,項目名稱:Voxelmetric,代碼行數:5,代碼來源:SaveProgress.cs


注:本文中的BlockPos.ContainingChunkCoordinates方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。