A* Pathfinding Project  4.1.3
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)
 Called for each path that the Seeker calculates after the calculation has finished.
 
- Public Member Functions inherited from MonoModifier
virtual void PreProcess (Path path)
 
- Public Member Functions inherited from IPathModifier
void Apply (Path path)
 
void PreProcess (Path path)
 

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
 

Protected Member Functions

void OnDestroy ()
 
- Protected Member Functions inherited from MonoModifier
virtual void OnDisable ()
 
virtual void OnEnable ()
 Alerts the Seeker that this modifier exists.
 
- Protected Member Functions inherited from VersionedMonoBehaviour
virtual void Awake ()
 
virtual int OnUpgradeSerializedData (int version, bool unityThread)
 Handle serialization backwards compatibility.
 

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.
 

Member Function Documentation

override void Apply ( Path  path)
virtual

Called for each path that the Seeker calculates after the calculation has finished.

Implements MonoModifier.

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

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: