Drag[en]gine Script Module DragonScript  1.23
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  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...
 

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

Member Function Documentation

◆ getAutoUpdate()

bool Dragengine.Scenery.ECBehaviorFootSteps.getAutoUpdate ( )

Call update() automatically on postThink().

◆ getBehaviorIn()

static ECBehaviorFootSteps Dragengine.Scenery.ECBehaviorFootSteps.getBehaviorIn ( BehaviorElementClass  eclass)
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()

Instance Dragengine.Scenery.ECBehaviorFootSteps.instance ( BehaviorElement  element)

Get instance in element from owner element class.

◆ new() [1/2]

ECBehaviorFootSteps Dragengine.Scenery.ECBehaviorFootSteps.new ( BehaviorElementClass  eclass)

Create behavior element class.

Reimplemented from Dragengine.Scenery.DefaultECBehavior.

◆ new() [2/2]

ECBehaviorFootSteps Dragengine.Scenery.ECBehaviorFootSteps.new ( BehaviorElementClass  eclass,
String  id 
)

Create default composeable behavior.

Reimplemented from Dragengine.Scenery.DefaultECBehavior.

◆ setAutoUpdate()

void Dragengine.Scenery.ECBehaviorFootSteps.setAutoUpdate ( bool  autoUpdate)

Set if update() is automatically called on postThink().

Member Data Documentation

◆ pAutoUpdate

bool Dragengine.Scenery.ECBehaviorFootSteps.pAutoUpdate

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