Class MazeGeneration
Generates a maze in the wall areas of a map, using crawlers that walk the map carving tunnels. Context Components Required:
- None Context Components Added/Used:
Component | Default Tag |
---|---|
ItemList<TItem> | "Tunnels" |
ISettableGridView<T> where T is bool | "WallFloor" |
Inherited Members
Namespace: GoRogue.MapGeneration.Steps
Assembly: GoRogue.dll
Syntax
public class MazeGeneration : GenerationStep
Remarks
This generation steps generates mazes, and adds the tunnels made to the ItemList<TItem> context component with the proper tag (if one is specified) on the GenerationContext. If no such component exists, one is created. It also sets the all locations inside the tunnels to true in the map's "WallFloor" map view context component. If the GenerationContext has an existing "WallFloor" context component, that component is used. If not, an ArrayView<T> where T is bool is created and added to the map context, whose width/height match Width/ Height.
Constructors
View SourceMazeGeneration(string?, string?, string?)
Creates a new maze generation step.
Declaration
public MazeGeneration(string? name = null, string? tunnelsComponentTag = "Tunnels", string? wallFloorComponentTag = "WallFloor")
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the generation step. Defaults to MazeGeneration. |
string | tunnelsComponentTag | Optional tag that must be associated with the component used to store tunnels/mazes created by the algorithm. Defaults to "Tunnels". |
string | wallFloorComponentTag | Optional tag that must be associated with the map view component used to store/set floor/wall status. Defaults to "WallFloor". |
Fields
View SourceCrawlerChangeDirectionImprovement
Out of 100, how much to increase the chance of a crawler changing direction each step. Once it changes direction, it resets to 0 and increases by this amount. Defaults to 10.
Declaration
public ushort CrawlerChangeDirectionImprovement
Field Value
Type | Description |
---|---|
ushort |
RNG
RNG to use for maze generation.
Declaration
public IEnhancedRandom RNG
Field Value
Type | Description |
---|---|
IEnhancedRandom |
TunnelsComponentTag
Optional tag that must be associated with the component used to store tunnels generated by this algorithm.
Declaration
public readonly string? TunnelsComponentTag
Field Value
Type | Description |
---|---|
string |
WallFloorComponentTag
Optional tag that must be associated with the component used to set wall/floor status of tiles changed by this algorithm.
Declaration
public readonly string? WallFloorComponentTag
Field Value
Type | Description |
---|---|
string |
Methods
View SourceOnPerform(GenerationContext)
Implement to perform the actual work of the generation step. Use "yield return null" to indicate the end of a "stage", eg. a point where execution can be paused when using GetStageEnumerator().
Declaration
protected override IEnumerator<object?> OnPerform(GenerationContext context)
Parameters
Type | Name | Description |
---|---|---|
GenerationContext | context | Context to perform the generation step on. |
Returns
Type | Description |
---|---|
IEnumerator<object> |