Drag[en]gine Script Module DragonScript
1.21
|
Behavior element behavior adding foot steps support to actors. More...
Classes | |
class | Configuration |
Foot step configuration. More... | |
class | DefaultListener |
Default implementation of behavior instance listener. More... | |
class | Event |
Foot step event. More... | |
class | Instance |
Behavior instance. More... | |
interface | Listener |
Listener for behavior instance events. More... | |
Public Member Functions | |
bool | getAutoUpdate () |
Call update() automatically on postThink(). More... | |
Instance | instance (BehaviorElement element) |
Get instance in element from owner element class. More... | |
ECBehaviorFootSteps | new (BehaviorElementClass eclass) |
Create behavior element class. More... | |
ECBehaviorFootSteps | new (BehaviorElementClass eclass, String prefix) |
Create default composeable behavior. More... | |
void | setAutoUpdate (bool autoUpdate) |
Set if update() is automatically called on postThink(). More... | |
Public Member Functions inherited from Dragengine.Scenery.DefaultECBehavior | |
void | assignInstanceIndex (int instanceIndex) |
Assign instance index. More... | |
void | dispose () |
Dispose of behavior. 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 ECBehaviorFootSteps | getBehaviorIn (BehaviorElementClass eclass) |
Get behavior in element class or null if absent. More... | |
Public Attributes | |
bool | pAutoUpdate |
Additional Inherited Members | |
Protected Member Functions inherited from Dragengine.Scenery.DefaultECBehavior | |
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 element behavior adding foot steps support to actors.
Uses a list of events to play random foot steps according to an elapsing time value. The elapsed time is updated with the elapsed game time while the actor is walking. If auto-update is true (which is the default) update() is called automatically by the behavior on thinking. Otherwise the actor has to call update(float) to advance the elapsed time. Independent of auto-updating the actor has to call reset() when standing still to ensure the events fire at the right time.
Events define for an elapsed time the sound to play. This is using a WeightedRandomList allowing to pick a random sound with support to favor certain sounds. The sound is then played at an offset relative to the behavior element with individual sound parameters. The sound parameters and offset are defined for each individual sound allowing special configurations like a pirate walking with a wooden leg.
It is common for actors to switch between different gaits (walking, running, robbing or sneaking). To make this process simple multiple configurations can be stored. The actor can then switch between configurations. Depending on how the animations are set up for the actor changing configuration has to reset the elapsed time or not. The actor is responsible to call reset() if required after switching configurations.
If you want to support different foot step sounds for different materials you should not use multiple configurations since switching them can reset the event timing. Use instead events with empty sound list and use the behavior listener to be notified when sound has to be played. See other behaviors for adding material foot step support as well as other special effects like triggering particle emitters.
This behavior can be present only one.
This behavior does require the element class to be persistable (setPersistable).
bool Dragengine.Scenery.ECBehaviorFootSteps.getAutoUpdate | ( | ) |
Call update() automatically on postThink().
|
static |
Get behavior in element class or null if absent.
Use this method to check if a particular BehaviorElementClass contains a behavior of type ECBehaviorFootSteps.
Instance Dragengine.Scenery.ECBehaviorFootSteps.instance | ( | BehaviorElement | element | ) |
Get instance in element from owner element class.
ECBehaviorFootSteps Dragengine.Scenery.ECBehaviorFootSteps.new | ( | BehaviorElementClass | eclass | ) |
Create behavior element class.
Reimplemented from Dragengine.Scenery.DefaultECBehavior.
ECBehaviorFootSteps Dragengine.Scenery.ECBehaviorFootSteps.new | ( | BehaviorElementClass | eclass, |
String | id | ||
) |
Create default composeable behavior.
Reimplemented from Dragengine.Scenery.DefaultECBehavior.
void Dragengine.Scenery.ECBehaviorFootSteps.setAutoUpdate | ( | bool | autoUpdate | ) |
Set if update() is automatically called on postThink().
bool Dragengine.Scenery.ECBehaviorFootSteps.pAutoUpdate |