Show / Hide Table of Contents

Class Path

Encapsulates a path as returned by pathfinding algorithms like AStar.

Inheritance
System.Object
Path
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: GoRogue.Pathing
Assembly: GoRogue.dll
Syntax
public class Path
Remarks

Provides various functions to iterate through/access steps of the path, as well as constant-time reversing functionality.

Constructors

| Improve this Doc View Source

Path(Path, Boolean)

Creates a copy of the path, optionally reversing the path as it does so.

Declaration
public Path(Path pathToCopy, bool reverse = false)
Parameters
Type Name Description
Path pathToCopy

The path to copy.

System.Boolean reverse

Whether or not to reverse the path. Defaults to false.

Remarks

Reversing is an O(1) operation, since it does not modify the list.

Properties

| Improve this Doc View Source

End

Ending point of the path.

Declaration
public Coord End { get; }
Property Value
Type Description
Coord
| Improve this Doc View Source

Length

The length of the path, NOT including the starting point.

Declaration
public int Length { get; }
Property Value
Type Description
System.Int32
| Improve this Doc View Source

LengthWithStart

The length of the path, INCLUDING the starting point.

Declaration
public int LengthWithStart { get; }
Property Value
Type Description
System.Int32
| Improve this Doc View Source

Start

Starting point of the path.

Declaration
public Coord Start { get; }
Property Value
Type Description
Coord
| Improve this Doc View Source

Steps

The coordinates that constitute the path (in order), NOT including the starting point. These are the coordinates something might walk along to follow a path.

Declaration
public IEnumerable<Coord> Steps { get; }
Property Value
Type Description
System.Collections.Generic.IEnumerable<Coord>
| Improve this Doc View Source

StepsWithStart

The coordinates that constitute the path (in order), INCLUDING the starting point.

Declaration
public IEnumerable<Coord> StepsWithStart { get; }
Property Value
Type Description
System.Collections.Generic.IEnumerable<Coord>

Methods

| Improve this Doc View Source

GetStep(Int32)

Gets the nth step along the path, where 0 is the step AFTER the starting point.

Declaration
public Coord GetStep(int stepNum)
Parameters
Type Name Description
System.Int32 stepNum

The (array-like index) of the step to get.

Returns
Type Description
Coord

The coordinate consituting the step specified.

| Improve this Doc View Source

GetStepWithStart(Int32)

Gets the nth step along the path, where 0 IS the starting point.

Declaration
public Coord GetStepWithStart(int stepNum)
Parameters
Type Name Description
System.Int32 stepNum

The (array-like index) of the step to get.

Returns
Type Description
Coord

The coordinate consituting the step specified.

| Improve this Doc View Source

Reverse()

Reverses the path, in constant time.

Declaration
public void Reverse()
| Improve this Doc View Source

ToString()

Returns a string representation of all the steps in the path, including the start point, eg. [(1, 2), (3, 4), (5, 6)].

Declaration
public override string ToString()
Returns
Type Description
System.String

A string representation of all steps in the path, including the start.

Overrides
System.Object.ToString()

Extension Methods

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