![]()  | 
  
    LayerProcGen v0.1.0
    
   Layer-based infinite procedural generation 
   | 
 
In a layer-and-chunk pair of classes, the layer inherits from this class. More...
Inherits AbstractChunkBasedDataLayer, and IChunkBasedDataLayer.
Public Member Functions | |
| virtual int | GetLevelCount () | 
| Override to specify the number of generation levels in the layer. Default is 1.  | |
| int | GetLevelCount () | 
| void | HandleAllAbstractChunks (int minChunkLevel, Action< AbstractLayerChunk > func) | 
| Handle all loaded chunks.   | |
| void | HandleDependenciesForLevel (int level, Action< LayerDependency > func) | 
| Handle all layer dependencies.   | |
| bool | IsLoadedAtPosition (DPoint position) | 
| Returns true if the layer is loaded at the highest level at the specified position  in world units.   | |
| bool | IsLoadedAtPosition (DPoint position, int level) | 
| Returns true if the layer is loaded at least up to level  at the specified position  in world units.   | |
Static Public Member Functions | |
| static bool | HasLayer< T > () | 
| Check if a layer of the specified type exists without creating it as a side effect.   | |
Protected Member Functions | |
| void | AddLayerDependency (int ownLevel, LayerDependency dependency) | 
| Call from constructor to add a dependency on another layer. The dependency is added to the specified ownLevel  of the current layer.  | |
| void | AddLayerDependency (LayerDependency dependency) | 
| Call from constructor to add a dependency on another layer. The dependency is added to the lowest level of the current layer.  | |
| ChunkBasedDataLayer (int rollingGridWidth=32, int rollingGridHeight=0, int rollingGridMaxOverlap=3) | |
| The layer constructor in inherited classes can be used to setup dependencies on other layers.   | |
| bool | GetChunkOfGridPoint (ILC q, int x, int y, int chunkGridW, int chunkGridH, out C chunk, out Point localPointInChunk) | 
| Assuming an infinite grid with a resolution per chunk of chunkGridW  by chunkGridH , output the chunk  and localPointInChunk  of the given global point. If iterating over many grid points, consider instead using HandleGridPoints.  | |
| bool | GetChunkOfGridPoint (ILC q, Point gridPoint, Point chunkGridSize, out C chunk, out Point localPointInChunk) | 
| Assuming an infinite grid with a resolution per chunk of chunkGridSize , output the chunk  and localPointInChunk  of the given global gridPoint . If iterating over many grid points, consider instead using HandleGridPoints.  | |
| void | HandleAllChunks (int minChunkLevel, Action< C > func) | 
| Handle all loaded chunks.  | |
| void | HandleChunksInBounds (ILC q, GridBounds worldBounds, int minChunkLevel, Action< C > func) | 
| Handle chunks that overlap the given worldBounds  specified in world units.  | |
| delegate void | HandleGridPointInChunk (C chunk, Point localPointInChunk, Point globalPoint) | 
| void | HandleGridPoints (ILC q, GridBounds gridBounds, Point chunkGridSize, HandleGridPointInChunk handler, bool callForNullChunks=false) | 
| Assuming an infinite grid with a resolution per chunk of chunkGridSize , call the handler function once for each of the grid points within the gridBounds . This is more efficient than calling GetChunkOfGridPoint for each grid point.  | |
| bool | TryGetChunk (Point index, out C chunk, int level=0) | 
| Try to get the chunk at the specified index.   | |
| void | WarnAboutMissingDependencies (ILC q, GridBounds requested) | 
| Call this method if a chunk q  has called methods that rely on other chunks that are not currently generated. Based on the bounds of q and the requested  world bounds of the current layer, the method will calculate which layer dependency has to be added to ensure the required chunks are generated in time.  | |
Protected Attributes | |
| readonly RollingGrid< C > | chunks | 
| readonly List< LayerDependency >[] | dependencies | 
Properties | |
| int | chunkH [get] | 
| int | chunkH [get] | 
| Point | chunkSize [get] | 
| Point | chunkSize [get] | 
| int | chunkW [get] | 
| int | chunkW [get] | 
| static L | instance [get] | 
| static IEnumerable< AbstractDataLayer > | layers [get] | 
| An enumeration of all current layers.  | |
In a layer-and-chunk pair of classes, the layer inherits from this class.
| L | The layer class itself. | 
| C | The corresponding chunk class. | 
| L | : | ChunkBasedDataLayer | |
| L | : | L | |
| L | : | C | |
| L | : | new() | |
| C | : | LayerChunk | |
| C | : | L | |
| C | : | C | |
| C | : | new() | 
      
  | 
  protected | 
The layer constructor in inherited classes can be used to setup dependencies on other layers.
| rollingGridWidth | The width of the rolling grid the chunks are stored in. The default is 32. | 
| rollingGridHeight | The height of the rolling grid the chunks are stored in. If set to 0, the value of rollingGridWidth is used. The default is 0. | 
| rollingGridMaxOverlap | The max overlap of the rolling grid the chunks are stored in. The default is 3. | 
| void HandleAllAbstractChunks | ( | int | minChunkLevel, | 
| Action< AbstractLayerChunk > | func ) | 
Handle all loaded chunks.
Implements IChunkBasedDataLayer.
| void HandleDependenciesForLevel | ( | int | level, | 
| Action< LayerDependency > | func ) | 
Handle all layer dependencies.
Implements IChunkBasedDataLayer.
      
  | 
  staticinherited | 
Check if a layer of the specified type exists without creating it as a side effect.
| T | : | AbstractDataLayer | 
| bool IsLoadedAtPosition | ( | DPoint | position | ) | 
Returns true if the layer is loaded at the highest level at the specified position in world units.
Implements IChunkBasedDataLayer.
| bool IsLoadedAtPosition | ( | DPoint | position, | 
| int | level ) | 
Returns true if the layer is loaded at least up to level at the specified position in world units.
Implements IChunkBasedDataLayer.
      
  | 
  protected | 
Try to get the chunk at the specified index.
| index | An integer coordinate that indexes into the grid of chunks. | 
| chunk | The requested chunk, or null. |