Пример #1
0
        public IEnumerable <VoxelHandle> FindLandNonBlocking(
            ChunkManager Data,
            GlobalVoxelCoordinate Start,
            int Radius)
        {
            int chunkSize = 64;
            int k         = 0;

            foreach (var coord in VoxelHelpers.BreadthFirstSearchNonBlocking(Data, Start, Radius,
                                                                             c =>
            {
                var v = new VoxelHandle(Data, c);
                if (!v.IsValid || !v.IsEmpty || v.LiquidLevel > 0)
                {
                    return(false);
                }
                var below = new VoxelHandle(Data,
                                            new GlobalVoxelCoordinate(c.X, c.Y - 1, c.Z));
                return(below.IsValid && !below.IsEmpty);
            }))
            {
                var v = new VoxelHandle(Data, coord);
                if (v.IsValid || k % chunkSize == 0)
                {
                    yield return(v);
                }
                k++;
            }
        }