Drag[en]gine Script Module DragonScript
1.23
|
Behavior adding support to unstuck actors moved by ECBehaviorActorMover. More...
Classes | |
class | Instance |
Behavior instance. More... | |
Public Member Functions | |
void | dispose () |
Dispose of behavior. More... | |
ECBehaviorActorMover | getActorMover () |
Actor mover behavior. More... | |
ECPFloat | getInterval () |
Update interval. More... | |
ECPFloat | getThreshold () |
Distance threshold. More... | |
Instance | instance (BehaviorElement element) |
Get instance in element from owner element class. More... | |
ECBehaviorActorMoverUnstuck | new (BehaviorElementClass eclass, ECBehaviorActorMover actorMover) |
Create behavior element class. More... | |
ECBehaviorActorMoverUnstuck | new (BehaviorElementClass eclass, ECBehaviorActorMover actorMover, String prefix) |
Public Member Functions inherited from Dragengine.Scenery.DefaultECBehavior | |
void | assignInstanceIndex (int instanceIndex) |
Assign instance index. More... | |
String | getBehaviorID () |
Unique identifier of behavior. More... | |
String | getID () |
Identifier. More... | |
int | getInstanceIndex () |
Instance index. More... | |
void | loadSupportedData (String identifier, PersistencyEnvironment env, FileReader reader, ECBehaviorInstance instance) |
Load instance data of another behavior. More... | |
bool | supportsBehaviorID (String identifier) |
Behavior supports loading instance data of another behavior. More... | |
Public Member Functions inherited from Dragengine.Scenery.ECBehavior | |
ECBehaviorInstance | createInstance (BehaviorElement element) |
Create Behavior instance. More... | |
Static Public Member Functions | |
static ECBehaviorActorMoverUnstuck | getBehaviorIn (BehaviorElementClass eclass) |
Get behavior in element class or null if absent. More... | |
Public Attributes | |
ECBehaviorActorMover | pActorMover |
ECPFloat | pInterval |
ECPFloat | pThreshold |
Additional Inherited Members | |
Protected Member Functions inherited from Dragengine.Scenery.DefaultECBehavior | |
DefaultECBehavior | new (BehaviorElementClass eclass) |
Create default composeable behavior with empty identifier. More... | |
DefaultECBehavior | new (BehaviorElementClass eclass, String id) |
Create default composeable behavior. More... | |
void | setBehaviorID (String identifier) |
Set behavior identifier. More... | |
void | useClassNameAsBehaviorID () |
Set behavior identifier to "<class-name>:<identifier>". More... | |
void | useFullyQualifiedClassNameAsBehaviorID () |
Set behavior identifier to "<fully-qualified-class-name>:<identifier>". More... | |
Behavior adding support to unstuck actors moved by ECBehaviorActorMover.
This behavior helps in situations where an actor moving along a path ends up in a stuck position. This can happen due to other behaviors like ECBehaviorAvoidCollision trying to avoid obstacles as well as due to game events pushing the actor into unfavorable positions.
This behavior attaches to ECBehaviorActorMover to track if actor is moving. If the actor is moving the position of the actor is examined after an interval. If the position does not change by a threshold amount relative to the last tracked position the actor is considered stuck and ECBehaviorActorMover.updatePath() is called to calculate a new path.
The default interval is 3 seconds. The threshold is factor multiplied by the distance the actor would travel unobstructed using the movement speed set in ECBehaviorActorMover. The default threshold is 0.2 (20% of expected movement distance).
These parameters can be adjusted to match the actors.
This behavior can be temporarily disabled at runtime if required. By default the behavior is enabled.
To use this behavior add it to the element class after ECBehaviorActorMover.
Requires these behaviors to be present:
void Dragengine.Scenery.ECBehaviorActorMoverUnstuck.dispose | ( | ) |
Dispose of behavior.
Reimplemented from Dragengine.Scenery.DefaultECBehavior.
ECBehaviorActorMover Dragengine.Scenery.ECBehaviorActorMoverUnstuck.getActorMover | ( | ) |
Actor mover behavior.
|
static |
Get behavior in element class or null if absent.
Use this method to check if a particular BehaviorElementClass contains a behavior of type ECBehaviorActorMoverUnstuck.
ECPFloat Dragengine.Scenery.ECBehaviorActorMoverUnstuck.getInterval | ( | ) |
Update interval.
ECPFloat Dragengine.Scenery.ECBehaviorActorMoverUnstuck.getThreshold | ( | ) |
Distance threshold.
Instance Dragengine.Scenery.ECBehaviorActorMoverUnstuck.instance | ( | BehaviorElement | element | ) |
Get instance in element from owner element class.
ECBehaviorActorMoverUnstuck Dragengine.Scenery.ECBehaviorActorMoverUnstuck.new | ( | BehaviorElementClass | eclass, |
ECBehaviorActorMover | actorMover | ||
) |
Create behavior element class.
ECBehaviorActorMoverUnstuck Dragengine.Scenery.ECBehaviorActorMoverUnstuck.new | ( | BehaviorElementClass | eclass, |
ECBehaviorActorMover | actorMover, | ||
String | prefix | ||
) |
ECBehaviorActorMover Dragengine.Scenery.ECBehaviorActorMoverUnstuck.pActorMover |
ECPFloat Dragengine.Scenery.ECBehaviorActorMoverUnstuck.pInterval |
ECPFloat Dragengine.Scenery.ECBehaviorActorMoverUnstuck.pThreshold |