Class ClosestMapAreaConnector
Implements a connection algorithm that connects all unique map areas in the given map by connecting each area with the one closest to it, based on closeness of the area's center points.
Inheritance
Inherited Members
Namespace: GoRogue.MapGeneration.Connectors
Assembly: GoRogue.dll
Syntax
public static class ClosestMapAreaConnector
Remarks
The algorithm functions by first finding all unique areas in the map given by using MapAreas(). Then, we iterate through each area, find the closest area that is not already conencted to the current area. Distance between to areas is measured as the distance between the center point of the bounding boxes of those areas. Points to connect two areas, as well as method used to create a tunnel between those two points, are selected via specified parameters.
Methods
| Improve this Doc View SourceConnect(ISettableMapView<Boolean>, Distance, IAreaConnectionPointSelector, ITunnelCreator)
Connects the given map using the algorithm described in the class description. Map areas are automatically determined using a MapAreaFinder.
Declaration
public static void Connect(ISettableMapView<bool> map, Distance distanceCalc, IAreaConnectionPointSelector areaConnector = null, ITunnelCreator tunnelCreator = null)
Parameters
Type | Name | Description |
---|---|---|
ISettableMapView<System.Boolean> | map | The map to connect. |
Distance | distanceCalc | The distance calculation that defines distance/neighbors. |
IAreaConnectionPointSelector | areaConnector | The area connection strategy to use. Not all methods function on maps with concave areas -- see respective class documentation for details. |
ITunnelCreator | tunnelCreator | The tunnel creation strategy to use. If null is specified, DirectLineTunnelCreator with the distance calculation specified is used. |
Connect(ISettableMapView<Boolean>, IReadOnlyList<MapArea>, Distance, IAreaConnectionPointSelector, ITunnelCreator)
Connects the map areas given on the given map using the algorithm described in the class description.
Declaration
public static void Connect(ISettableMapView<bool> map, IReadOnlyList<MapArea> mapAreas, Distance distanceCalc, IAreaConnectionPointSelector areaConnector = null, ITunnelCreator tunnelCreator = null)
Parameters
Type | Name | Description |
---|---|---|
ISettableMapView<System.Boolean> | map | The map to connect. |
System.Collections.Generic.IReadOnlyList<MapArea> | mapAreas | The map areas to connect on the given map. |
Distance | distanceCalc | The distance calculation that defines distance/neighbors. |
IAreaConnectionPointSelector | areaConnector | The area connection strategy to use. Not all methods function on maps with concave areas -- see respective class documentation for details. |
ITunnelCreator | tunnelCreator | The tunnel creation strategy to use. If null is specified, DirectLineTunnelCreator with the distance calculation specified is used. |