Class WalkPlan
Class that represents a creature's walk plan.
Inheritance
Inherited Members
Namespace: Fibula.Creatures.Contracts.Structs
Assembly: Fibula.Creatures.Contracts.dll
Syntax
public class WalkPlanConstructors
| Improve this Doc View SourceWalkPlan(WalkPlanStrategy, Func<Location>, Int32, Location[])
Initializes a new instance of the WalkPlan class.
Declaration
public WalkPlan(WalkPlanStrategy strategy, Func<Location> goalDeterminationFunction, int goalDistance = 1, params Location[] startingWaypoints)Parameters
| Type | Name | Description | 
|---|---|---|
| WalkPlanStrategy | strategy | The strategy of the plan. | 
| System.Func<Location> | goalDeterminationFunction | A function used to determine the goal of this plan. | 
| System.Int32 | goalDistance | The distance to consider the walk plan at goal. | 
| Location[] | startingWaypoints | The waypoints already known to the goal. | 
Properties
| Improve this Doc View SourceGetGoalLocation
Gets the function that determines the goal location, used when requesting recalculation of the path to the goal.
Declaration
public Func<Location> GetGoalLocation { get; }Property Value
| Type | Description | 
|---|---|
| System.Func<Location> | 
GoalTargetDistance
Gets the target distance to use when requesting recalculation of the path to the goal.
Declaration
public int GoalTargetDistance { get; }Property Value
| Type | Description | 
|---|---|
| System.Int32 | 
State
Gets or sets the state of this walk plan.
Declaration
public WalkPlanState State { get; set; }Property Value
| Type | Description | 
|---|---|
| WalkPlanState | 
Strategy
Gets the strategy of this walk plan.
Declaration
public WalkPlanStrategy Strategy { get; }Property Value
| Type | Description | 
|---|---|
| WalkPlanStrategy | 
WaitTime
Gets the recommended wait time based on the last Checkpoint(Location, Random) run.
Declaration
public TimeSpan WaitTime { get; }Property Value
| Type | Description | 
|---|---|
| System.TimeSpan | 
Waypoints
Gets the waypoints of this walk plan.
Declaration
public LinkedList<Location> Waypoints { get; }Property Value
| Type | Description | 
|---|---|
| System.Collections.Generic.LinkedList<Location> | 
Methods
| Improve this Doc View SourceCheckpoint(Location, Random)
Steps into the next waypoint in the plan by comparing it to the current location and updating its state. i.e. this flags the plan to recalculate as per the WalkPlanStrategy rules.
Declaration
public void Checkpoint(Location currentLocation, Random rng = null)Parameters
| Type | Name | Description | 
|---|---|---|
| Location | currentLocation | The current location to check against. | 
| System.Random | rng | Optional. A pseudo-random number generator to work with. | 
RecalculateWaypoints(Location, IEnumerable<Direction>)
Recalculates the plan's waypoints (locations) given a start location and some directions.
Declaration
public void RecalculateWaypoints(Location startLocation, IEnumerable<Direction> directions)Parameters
| Type | Name | Description | 
|---|---|---|
| Location | startLocation | The start location. | 
| System.Collections.Generic.IEnumerable<Direction> | directions | The directions to create the waypoints with. |