Show / Hide Table of Contents

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.

Inheritance
object
DirectLineTunnelCreator
Implements
ITunnelCreator
Inherited Members
object.GetType()
object.MemberwiseClone()
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
Namespace: GoRogue.MapGeneration.TunnelCreators
Assembly: GoRogue.dll
Syntax
public class DirectLineTunnelCreator : ITunnelCreator

Constructors

View Source

DirectLineTunnelCreator(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 Source

CreateTunnel(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.

View Source

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.

Implements

ITunnelCreator

Extension Methods

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