示例#1
0
        private static void SwapChunks(this ClipmapLevel clipmapLevel, Dictionary <Int3, ClipmapChunk> clipmapChunks)
        {
            Logger.Info($"{clipmapLevel}: Swapping chunks");

            foreach (var cellChunkPair in clipmapChunks)
            {
                var cell         = clipmapLevel.GetCell(cellChunkPair.Key);
                var clipmapChunk = cellChunkPair.Value;

                if (cell != null && cell.IsLoaded())
                {
                    cell.SwapChunk(clipmapChunk);
                }
                else
                {
                    Logger.Warning($"Clipmap Cell {cellChunkPair.Key} is not loaded or null, skipping swapping chunks and destroying new one");
                    UnityEngine.Object.Destroy(clipmapChunk);
                }
            }
        }
示例#2
0
        private static List <ClipmapCell> GetProcessingCells(this ClipmapLevel clipmapLevel, List <Int3.Bounds> blockRanges)
        {
            var processingCells = new List <ClipmapCell>();

            foreach (var blockRange in blockRanges)
            {
                var cellBounds = clipmapLevel.GetCellRange(blockRange);

                foreach (Int3 cellId in cellBounds)
                {
                    ClipmapCell cell = clipmapLevel.GetCell(cellId);
                    if (cell != null)
                    {
                        if (!processingCells.Contains(cell))
                        {
                            processingCells.Add(cell);
                        }
                    }
                }
            }

            return(processingCells);
        }