public void SetMaxViewingLevel(float level, ChunkManager.SliceMode slice) { Slice = slice; MaxViewingLevel = Math.Max(Math.Min(level, ChunkSizeY), 1); foreach (VoxelChunk c in ChunkMap.Select(chunks => chunks.Value).Where(c => c.NeedsViewingLevelChange())) { c.ShouldRecalculateLighting = false; c.ShouldRebuild = true; } }
// Final argument is always mode Y. // Todo: %KILL% - does not belong here. public void SetMaxViewingLevel(int level, ChunkManager.SliceMode slice) { if (level == MaxViewingLevel && slice == Slice) { return; } SoundManager.PlaySound(ContentPaths.Audio.Oscar.sfx_gui_click_voxel, 0.15f, (float)(level / (float)VoxelConstants.ChunkSizeY) - 0.5f); var oldLevel = MaxViewingLevel; Slice = slice; MaxViewingLevel = Math.Max(Math.Min(level, VoxelConstants.ChunkSizeY), 1); foreach (var c in ChunkMap) { c.InvalidateSlice(oldLevel - 1); c.InvalidateSlice(MaxViewingLevel - 1); } }
public static IEnumerable <GlobalVoxelCoordinate> EnumerateManhattanNeighbors2D( GlobalVoxelCoordinate Coordinate, ChunkManager.SliceMode SliceMode) { switch (SliceMode) { case ChunkManager.SliceMode.X: return(EnumerateNeighbors(ManhattanNeighbors2D.Select(n => new GlobalVoxelOffset(0, -n.Z, n.X)), Coordinate)); case ChunkManager.SliceMode.Y: return(EnumerateNeighbors(ManhattanNeighbors2D, Coordinate)); case ChunkManager.SliceMode.Z: return(EnumerateNeighbors(ManhattanNeighbors2D.Select(n => new GlobalVoxelOffset(n.X, -n.Z, 0)), Coordinate)); default: throw new InvalidOperationException(); } }