Class DirectLineTunnelCreator
Implements a tunnel creation algorithm that sets as walkable a direct line between the two points. In the case that Manhattan is being used, the line is calculated via the Orthogonal algorithm. Otherwise, the line is calculated using Bresenham.
Implements
Inherited Members
Namespace: GoRogue.MapGeneration.TunnelCreators
Assembly: GoRogue.dll
Syntax
public class DirectLineTunnelCreator : ITunnelCreator
Constructors
View SourceDirectLineTunnelCreator(AdjacencyRule, bool)
Constructor. Takes the distance calculation to use, which determines whether Orthogonal or Bresenham is used to create the tunnel.
Declaration
public DirectLineTunnelCreator(AdjacencyRule adjacencyRule, bool doubleWideVertical = true)
Parameters
Type | Name | Description |
---|---|---|
AdjacencyRule | adjacencyRule | Method of adjacency to respect when creating tunnels. Cannot be diagonal. |
bool | doubleWideVertical | Whether or not to create vertical tunnels as 2-wide. |
Methods
View SourceCreateTunnel(ISettableGridView<bool>, Point, Point)
Implements the algorithm, creating the tunnel between the two points (ensuring there is a path of positions set to true between those two points).
Declaration
public Area CreateTunnel(ISettableGridView<bool> map, Point start, Point end)
Parameters
Type | Name | Description |
---|---|---|
ISettableGridView<bool> | map | _grid to create the tunnel on. |
Point | start | |
Point | end |
Returns
Type | Description |
---|---|
Area | An area containing all points that are part of the tunnel. |
CreateTunnel(ISettableGridView<bool>, int, int, int, int)
Implements the algorithm, creating the tunnel between the two points (ensuring there is a path of positions set to true between those two points).
Declaration
public Area CreateTunnel(ISettableGridView<bool> map, int startX, int startY, int endX, int endY)
Parameters
Type | Name | Description |
---|---|---|
ISettableGridView<bool> | map | _grid to create the tunnel on. |
int | startX | X-value of the start position to connect. |
int | startY | Y-value of the start position to connect. |
int | endX | X-value of the end position to connect. |
int | endY | Y-value of the end position to connect. |
Returns
Type | Description |
---|---|
Area | An area containing all points that are part of the tunnel. |