A* Pathfinding Project
4.1.2
The A* Pathfinding Project for Unity 3D
|
Applies penalty to the paths it processes telling other units to avoid choosing the same path. More...
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 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 |
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< GraphNode > | prevNodes = 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. | |
|
virtual |
Main Post-Processing function.
Implements MonoModifier.
|
private |
|
private |
|
private |
|
virtual |
Reimplemented from MonoModifier.
|
private |
int penalty = 1000 |
How much penalty (weight) to apply to nodes.
|
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.
|
private |
A random object.
|
get |