Show / Hide Table of Contents

Class ClosestMapAreaConnection

Connects areas of the map by connecting each area to its closest neighboring area, with distance between areas based on the connection point selector specified. Context Components Required:

ComponentDefault Tag
ItemList<TItem> "Areas"
ISettableGridView<T> where T is bool"WallFloor"
Context Components Added/Used:
ComponentDefault Tag
ItemList<TItem> "Tunnels"
In the case of the tunnels component, an existing component is used if an appropriate one is present; a new one is added if not.
Inheritance
Object
GenerationStep
ClosestMapAreaConnection
Inherited Members
GenerationStep.Name
GenerationStep.PerformStep(GenerationContext)
GenerationStep.GetStageEnumerator(GenerationContext)
GenerationStep.RequiredComponents
Namespace: GoRogue.MapGeneration.Steps
Assembly: GoRogue.dll
Syntax
public class ClosestMapAreaConnection : GenerationStep
Remarks

This generation steps takes as input a ItemList<TItem> context component (with the tag "Areas", by default) containing areas to connect, and "WallFloor" map view context component that indicates wall/floor status for each location on the map. It then connects the map areas in the list, generating tunnels in the process. Each location comprising the generated tunnels is set to "true" in the "WallFloor" component. Additionally, an Area representing each tunnel created is added to the ItemList<TItem> context component (with the tag "Tunnels", by default). If an appropriate component with the specified tag exists for the resulting tunnels, the Areas are added to that component. Otherwise, a new component is created. Areas are connected by drawing a tunnel between each Area and its closest neighboring area, based on distance between the points selected by the given ConnectionPointSelector. The actual points selected in each area to connect, as well as the method for drawing tunnels between those areas, is customizable via the ConnectionPointSelector and TunnelCreator parameters.

Constructors

ClosestMapAreaConnection(String, String, String, String)

Creates a new closest area connection step.

Declaration
public ClosestMapAreaConnection(string name = null, string wallFloorComponentTag = "WallFloor", string areasComponentTag = "Areas", string tunnelsComponentTag = "Tunnels")
Parameters
Type Name Description
String name

The name of the generation step. Defaults to ClosestMapAreaConnection.

String wallFloorComponentTag

Optional tag that must be associated with the map view component used to store/set floor/wall status. Defaults to "WallFloor".

String areasComponentTag

Optional tag that must be associated with the component used to store map areas connected by this algorithm. Defaults to "Areas".

String tunnelsComponentTag

Optional tag that must be associated with the component created/used to store the tunnels created by this connection method. Defaults to "Tunnels".

Fields

AreasComponentTag

Optional tag that must be associated with the component used to store map areas connected by this algorithm.

Declaration
public readonly string AreasComponentTag
Field Value
Type Description
String

ConnectionPointSelector

The area connection strategy to use. Not all methods function on maps with concave areas -- see respective class documentation for details.

Declaration
public IConnectionPointSelector ConnectionPointSelector
Field Value
Type Description
IConnectionPointSelector

DistanceCalc

The distance calculation that defines distance/neighbors.

Declaration
public Distance DistanceCalc
Field Value
Type Description
Distance

TunnelCreator

The tunnel creation strategy to use. Defaults to DirectLineTunnelCreator with the cardinal adjacency rules.

Declaration
public ITunnelCreator TunnelCreator
Field Value
Type Description
ITunnelCreator

TunnelsComponentTag

Optional tag that must be associated with the component created/used to store the tunnels created by this connection method.

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

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

Context to perform the generation step on.

Returns
Type Description
IEnumerator<Object>
Overrides
GenerationStep.OnPerform(GenerationContext)

Extension Methods

Utility.Yield<T>(T)
In This Article
Back to top Generated by DocFX