Drag[en]gine Script Module DragonScript 1.32.1
Loading...
Searching...
No Matches
Dragengine.Scenery.ECBehaviorFootSteps Class Reference

Behavior element behavior adding foot steps support to actors. More...

Inheritance diagram for Dragengine.Scenery.ECBehaviorFootSteps:
Dragengine.Scenery.DefaultECBehavior Dragengine.Scenery.ECBehavior Dragengine.Scenery.BehaviorCompatiblePersistency

Classes

class  Configuration
 Foot step configuration. More...
 
class  DefaultListener
 Default implementation of behavior instance listener. More...
 
class  Event
 Foot step event. More...
 
class  Factory
 Behavior factory. More...
 
class  Instance
 Behavior instance. More...
 
interface  Listener
 Listener for behavior instance events. More...
 

Additional Inherited Members

- Public Member Functions inherited from Dragengine.Scenery.DefaultECBehavior
void assignInstanceIndex (int instanceIndex)
 Assign instance index.
 
void dispose ()
 Dispose of behavior.
 
String getBehaviorID ()
 Unique identifier of behavior.
 
String getID ()
 Identifier.
 
int getInstanceIndex ()
 Instance index.
 
void loadSupportedData (String identifier, PersistencyEnvironment env, FileReader reader, ECBehaviorInstance instance)
 Load instance data of another behavior.
 
bool supportsBehaviorID (String identifier)
 Behavior supports loading instance data of another behavior.
 
- Public Member Functions inherited from Dragengine.Scenery.ECBehavior
ECBehaviorInstance createInstance (BehaviorElement element)
 Create Behavior instance.
 
- Protected Member Functions inherited from Dragengine.Scenery.DefaultECBehavior
DefaultECBehavior new (BehaviorElementClass eclass)
 Create default composeable behavior with empty identifier.
 
DefaultECBehavior new (BehaviorElementClass eclass, String id)
 Create default composeable behavior.
 
void setBehaviorID (String identifier)
 Set behavior identifier.
 
void useClassNameAsBehaviorID ()
 Set behavior identifier to "<class-name>:<identifier>".
 
void useFullyQualifiedClassNameAsBehaviorID ()
 Set behavior identifier to "<fully-qualified-class-name>:<identifier>".
 

Detailed Description

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).

See also
https://developer.dragondreams.ch/wiki/doku.php/dragengine:modules:dragonscript:behavior_footsteps

The documentation for this class was generated from the following file: