A* Pathfinding Project  4.0.8
The A* Pathfinding Project for Unity 3D
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Events Macros Groups Pages
AlternativePath Class Reference

Applies penalty to the paths it processes telling other units to avoid choosing the same path. More...

Detailed Description

Applies penalty to the paths it processes telling other units to avoid choosing the same path.

Note that this might not work properly if penalties are modified by other actions as well (e.g graph update objects which reset the penalty to zero). It will only work when all penalty modifications are relative, i.e adding or subtracting penalties, but not when setting penalties to specific values.

When destroyed, it will correctly remove any added penalty.

Public Member Functions

override void Apply (Path p)
 Main Post-Processing function.
 
override void OnDestroy ()
 
- Public Member Functions inherited from MonoModifier
void OnDisable ()
 
void OnEnable ()
 
virtual void PreProcess (Path p)
 
- Public Member Functions inherited from IPathModifier
void Apply (Path p)
 
void PreProcess (Path p)
 

Public Attributes

int penalty = 1000
 How much penalty (weight) to apply to nodes.
 
int randomStep = 10
 Max number of nodes to skip in a row.
 
- Public Attributes inherited from MonoModifier
Seeker seeker
 

Properties

override int Order [get]
 
- Properties inherited from MonoModifier
abstract int Order [get]
 Modifiers will be executed from lower order to higher order.
 
- Properties inherited from IPathModifier
int Order [get]
 

Private Member Functions

void ApplyNow (List< GraphNode > nodes)
 
void ClearOnDestroy ()
 
void InversePrevious ()
 

Private Attributes

bool destroyed
 
List< GraphNodeprevNodes = new List<GraphNode>()
 The previous path.
 
int prevPenalty
 The previous penalty used.
 
readonly System.Random rnd = new System.Random()
 A random object.
 

Additional Inherited Members

- Protected Member Functions inherited from MonoModifier
override void Awake ()
 Alerts the Seeker that this modifier exists.
 

Member Function Documentation

override void Apply ( Path  p)
virtual

Main Post-Processing function.

Implements MonoModifier.

void ApplyNow ( List< GraphNode nodes)
private
void ClearOnDestroy ( )
private
void InversePrevious ( )
private
override void OnDestroy ( )
virtual

Reimplemented from MonoModifier.

Member Data Documentation

bool destroyed
private
int penalty = 1000

How much penalty (weight) to apply to nodes.

List<GraphNode> prevNodes = new List<GraphNode>()
private

The previous path.

int prevPenalty
private

The previous penalty used.

Stored just in case it changes during operation

int randomStep = 10

Max number of nodes to skip in a row.

readonly System.Random rnd = new System.Random()
private

A random object.

Property Documentation

override int Order
get

The documentation for this class was generated from the following file: