Esempio n. 1
0
     public static IEnumerable <ElevatorExit> EnumerateExits(ElevatorStack Stack)
     {
         foreach (var segment in Stack.Pieces)
         {
             foreach (var neighborVoxel in VoxelHelpers.EnumerateManhattanNeighbors2D_Y(segment.GetContainingVoxel().Coordinate))
             {
                 var neighborHandle = new VoxelHandle(segment.Manager.World.ChunkManager, neighborVoxel);
                 if (neighborHandle.IsValid && neighborHandle.IsEmpty)
                 {
                     var below       = neighborVoxel + new GlobalVoxelOffset(0, -1, 0);
                     var belowHandle = new VoxelHandle(segment.Manager.World.ChunkManager, below);
                     if (belowHandle.IsValid && !belowHandle.IsEmpty)
                     {
                         yield return new ElevatorExit
                                {
                                    OntoVoxel    = neighborHandle,
                                    ShaftSegment = segment
                                }
                     }
                     ;
                 }
             }
         }
     }
 }
Esempio n. 2
0
 public IEnumerable <VoxelHandle> EnumerateExits()
 {
     foreach (var neighborVoxel in VoxelHelpers.EnumerateManhattanNeighbors2D_Y(GlobalVoxelCoordinate.FromVector3(Position)))
     {
         var below          = neighborVoxel + new GlobalVoxelOffset(0, -1, 0);
         var neighborHandle = new VoxelHandle(Manager.World.ChunkManager, neighborVoxel);
         if (neighborHandle.IsValid && neighborHandle.IsEmpty)
         {
             var belowHandle = new VoxelHandle(Manager.World.ChunkManager, below);
             if (belowHandle.IsValid && !belowHandle.IsEmpty)
             {
                 yield return(neighborHandle);
             }
         }
     }
 }