A* Pathfinding Project
4.2.1
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) |
Called for each path that the Seeker calculates after the calculation has finished. More... | |
Public Member Functions inherited from MonoModifier | |
virtual void | PreProcess (Path path) |
Public Attributes | |
int | penalty = 1000 |
How much penalty (weight) to apply to nodes. More... | |
int | randomStep = 10 |
Max number of nodes to skip in a row. More... | |
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. More... | |
Protected Member Functions inherited from VersionedMonoBehaviour | |
virtual void | Awake () |
virtual int | OnUpgradeSerializedData (int version, bool unityThread) |
Handle serialization backwards compatibility. More... | |
virtual void | Reset () |
Handle serialization backwards compatibility. More... | |
Properties | |
override int | Order [get] |
Properties inherited from MonoModifier | |
abstract int | Order [get] |
Modifiers will be executed from lower order to higher order. More... | |
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. More... | |
int | prevPenalty |
The previous penalty used. More... | |
readonly System.Random | rnd = new System.Random() |
A random object. More... | |
|
virtual |
Called for each path that the Seeker calculates after the calculation has finished.
Implements MonoModifier.
|
private |
|
private |
|
private |
|
protected |
|
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 |