Start Page » DragonScript Scripting Language » Abstraction Layers: How you want to build your Game » Behavior Elements » ECBehaviorFootStepConfig
Behavior adding a single foot step configuration with a list of events. Optionally a list of sounds can be defined which is assigned to the events. All events share the same sounds and play sound parameters.
Multiple ECBehaviorFootStepConfig to add multiple foot step configurations.
Element class properties have the prefix footStepConfig.
or footStepConfig({id}).
if id is not empty.
Set identifier of configuration.
footStepConfig.configId
or footStepConfig({id}).configId
<string name='footStepConfig.configId'>walk</string>
Set interval in seconds between repeating foot steps.
camera.interval
or camera({id}).interval
1
0
<float name='camera.interval'>0.6</value>
Set actor animated controller name to use as elapsed time. Typically a controller updated by the moved distance is used. This allows to synchronize foot steps to animations easily. Keep in mind that event times are measured in the range from 0 to 1 instead of seconds if a controller is used. This allows animations of different length to be used with the same configuration.
footStepConfig.controllerName
or footStepConfig({id}).controllerName
<string name='footStepConfig.controllerName'>walking</string>
List of path of sound resource to randomly choose from.
footStepConfig.sounds
or footStepConfig({id}).sounds
*.ogg
(all sound modules)<list name='footStepConfig.sounds'> <string>step1.ogg</string> <string>step2.ogg</string> </list>
Set volume of foot step sound played.
footStepConfig.volume
or footStepConfig({id}).volume
1
0
<float name='footStepConfig.volume'>0.2</value>
Set range of foot step sound played.
footStepConfig.range
or footStepConfig({id}).range
10
0
<float name='footStepConfig.range'>10</value>
Set rollOff of foot step sound played. Determines of quickly the sound volume diminishes towards the range. Value is in the range from 0 to 1 with 0.1 being a natural roll-off
footStepConfig.rollOff
or footStepConfig({id}).rollOff
0.5
0
and at most 1
<float name='footStepConfig.rollOff'>0.5</value>
Offset relative to element position to play sound at.
footStepConfig.offset
or footStepConfig({id}).offset
(0, 0.05, 0)
<vector name='footStepConfig.offset' x='0' y='0.05' z='0'/>
Set custom type identifier. Optional value which can be used by behaviors to play custom tailored sounds.
footStepConfig.type
or footStepConfig({id}).type
<string name='footStepConfig.type'>stone</string>
List of event times. For each list entry an event is added to the configuration using the properties outline above. If controllerName
is empty the times are in seconds. If controllerName
is not empty the times are in the range from 0 to 1 representing relative time values across the controller value range. Event time values must be in increasing order.
footStepConfig.eventTimes
or footStepConfig({id}).eventTimes
*.ogg
(all sound modules)<list name='footStepConfig.eventTimes'> <float>0.2</float> <float>0.6</float> </list>
This behavior provides no events.
This behavior requires no other behaviors.
This behavior does not require element class persistency (setPersistable).
Since DragonScript Module Version 1.26
This example defines an element which two foot step configurations.
class MyElement extends BehaviorElementClass public var ECBehaviorFootSteps footSteps public var ECBehaviorFootStepConfig footStepsWalk, footStepsRun func new() footSteps = ECBehaviorFootSteps.new(this) footStepsWalk = ECBehaviorFootStepConfig.new(this, footSteps, "walk") footStepsWalk.getInterval().setValue(0.6) footStepsRun = ECBehaviorFootStepConfig.new(this, footSteps, "run") footStepsRun.getInterval().setValue(0.4) end end
Using element class supporting adding behaviors the behavior can be added like this:
<?xml version='1.0' encoding='UTF-8'?> <elementClass name='MyClass' class='GenericBehaviorElement'> <behavior type='ECBehaviorFootSteps'/> <behavior type='ECBehaviorFootStepConfig' id='walk'> <!-- behavior factory automatically assigns all required behaviors --> <!-- set element properties. omit property prefix if used inside behavior tag --> <string name='.configId'>walk</string> <float name='.interval'>0.6</float> <float name='.volume'>0.2</float> <float name='.range'>20</float> <list name='.sounds'> <string>/content/sound/footstep1.ogg</string> <string>/content/sound/footstep2.ogg</string> </list> <list name='.eventTimes'> <float>0.5</float> </list> </behavior> <behavior type='ECBehaviorFootStepConfig' id='run'> ... </behavior> </elementClass>