Class Path
A class representing an ordered list of Cells from Start to End The path can be traversed by the StepForward and StepBackward methods Implemented by a doubly linked list
Inheritance
Inherited Members
Namespace: RogueSharp
Assembly: RogueSharp.dll
Syntax
public class Path
Constructors
| Improve this Doc View SourcePath(IEnumerable<ICell>)
Construct a new Path from the specified ordered list of Cells
Declaration
public Path(IEnumerable<ICell> steps)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<ICell> | steps | An IEnumerable of Cells that represent the ordered steps along this Path from Start to End |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown when the specified steps parameter is null |
System.ArgumentException | Thrown when the specified steps parameter is empty |
Properties
| Improve this Doc View SourceCurrentStep
The Cell representing the step that is currently occupied in this Path
Declaration
public ICell CurrentStep { get; }
Property Value
Type | Description |
---|---|
ICell |
End
The Cell representing the last step or End of this Path
Declaration
public ICell End { get; }
Property Value
Type | Description |
---|---|
ICell |
Length
The number of steps in this Path
Declaration
public int Length { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Start
The Cell representing the first step or Start of this Path
Declaration
public ICell Start { get; }
Property Value
Type | Description |
---|---|
ICell |
Steps
All of the Cells representing the Steps in this Path from Start to End as an IEnumerable
Declaration
public IEnumerable<ICell> Steps { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<ICell> |
Methods
| Improve this Doc View SourceStepBackward()
Move backwards along this Path and rewind the CurrentStep to the previous Step in the Path
Declaration
public ICell StepBackward()
Returns
Type | Description |
---|---|
ICell | A Cell representing the Step that was moved to as we back up along the Path |
Exceptions
Type | Condition |
---|---|
NoMoreStepsException | Thrown when attempting to move backward along a Path on which we are currently at the Start |
StepForward()
Move forward along this Path and advance the CurrentStep to the next Step in the Path
Declaration
public ICell StepForward()
Returns
Type | Description |
---|---|
ICell | A Cell representing the Step that was moved to as we advanced along the Path |
Exceptions
Type | Condition |
---|---|
NoMoreStepsException | Thrown when attempting to move forward along a Path on which we are currently at the End |
TryStepBackward()
Move backwards along this Path and rewind the CurrentStep to the next Step in the Path
Declaration
public ICell TryStepBackward()
Returns
Type | Description |
---|---|
ICell | A Cell representing the Step that was moved to as we back up along the Path. If there is not another Cell in the path to back up to null is returned |
TryStepForward()
Move forward along this Path and advance the CurrentStep to the next Step in the Path
Declaration
public ICell TryStepForward()
Returns
Type | Description |
---|---|
ICell | A Cell representing the Step that was moved to as we advanced along the Path. If there is not another Cell in the path to advance to null is returned |