Show / Hide Table of Contents

Class GenerationStep

Base class for implementing custom map generation steps.

Inheritance
object
GenerationStep
AreaFinder
CellularAutomataAreaGeneration
ClosestMapAreaConnection
DoorFinder
MazeGeneration
OrderedMapAreaConnection
RandomViewFill
RectangleGenerator
RoomDoorConnection
RoomsGeneration
AppendItemLists<TItem>
RectanglesToAreas
RemoveDuplicatePoints
TunnelDeadEndTrimming
Inherited Members
object.GetType()
object.MemberwiseClone()
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
Namespace: GoRogue.MapGeneration
Assembly: GoRogue.dll
Syntax
public abstract class GenerationStep

Constructors

View Source

GenerationStep(string?)

Creates a generation step, optionally with a custom name.

Declaration
protected GenerationStep(string? name = null)
Parameters
Type Name Description
string name

The name of the generation step being created. Defaults to the name of the (runtime) class.

View Source

GenerationStep(string?, params ComponentTypeTagPair[])

Creates a generation step that requires the given component(s) on the GenerationContext to function.

Declaration
protected GenerationStep(string? name = null, params ComponentTypeTagPair[] requiredComponents)
Parameters
Type Name Description
string name

The name of the generation step being created. Defaults to the name of the (runtime) class.

ComponentTypeTagPair[] requiredComponents

Components that OnPerform(GenerationContext) will require from the context, and the tag required for each component. Null means no particular tag is required.

View Source

GenerationStep(string?, params Type[])

Creates a generation step that requires the given component(s) on the GenerationContext to function.

Declaration
protected GenerationStep(string? name = null, params Type[] requiredComponents)
Parameters
Type Name Description
string name

The name of the generation step being created. Defaults to the name of the (runtime) class.

Type[] requiredComponents

Components (and associated tags) that OnPerform(GenerationContext) will require from the context. Null specified as a tag means no particular tag is required; only a component of the given type.

Fields

View Source

Name

The name of the generation step.

Declaration
public readonly string Name
Field Value
Type Description
string

Properties

View Source

RequiredComponents

Components that are required and enforced to be on the GenerationContext when it is passed to OnPerform(GenerationContext). Each component may optionally have a required tag.

Declaration
public IEnumerable<ComponentTypeTagPair> RequiredComponents { get; }
Property Value
Type Description
IEnumerable<ComponentTypeTagPair>

Methods

View Source

GetStageEnumerator(GenerationContext)

Return an enumerator that, when evaluated to completion, will perform each "stage" of the generation step sequentially.

Declaration
public IEnumerator<object?> GetStageEnumerator(GenerationContext context)
Parameters
Type Name Description
GenerationContext context

Context to perform the generation step on.

Returns
Type Description
IEnumerator<object>

An enumerator which, when evaluated, performs each stage of the step sequentially.

View Source

OnPerform(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 abstract IEnumerator<object?> OnPerform(GenerationContext context)
Parameters
Type Name Description
GenerationContext context

Context to perform the generation step on.

Returns
Type Description
IEnumerator<object>
View Source

PerformStep(GenerationContext)

Performs the generation step on the given map context. Throws exception if a required component is missing. This function is not virtual -- to implement actual generation logic, implement OnPerform(GenerationContext).

Declaration
public void PerformStep(GenerationContext context)
Parameters
Type Name Description
GenerationContext context

Context to perform the generation step on.

Extension Methods

Utility.Yield<T>(T)
  • View Source
In this article
Back to top Generated by DocFX