This is an old revision of the document!
Start Page » DragonScript Scripting Language » Abstraction Layers: How you want to build your Game » Behavior Elements » ECBehaviorParticleEmitter
Behavior element behavior adding particle emitter support.
Behavior adds a ParticleEmitter resource to the the behavior element.
If the ECBehaviorCollider behavior is present in the behavior element before this behavior is added the particle emitter is attached. The particle emitter is attached to the named bone if defined otherwise it is attached statically.
See also:
This behavior can be added multiple times to an element. Each instance creates one particle emitter attached to the element collider which can be individually modified.
Element class properties have the prefix particleEmitter.
or particleEmitter({id}).
if id is not empty.
Set path to particle emitter resource to use.
particleEmitter.path
or particleEmitter({id}).path
*.depemit
<string name='particleEmitter.path'>fire.depemit</string>
Set time scale for controllers advanced by time.
particleEmitter.timeScale
or particleEmitter({id}).timeScale
<float name='particleEmitter.timeScale'>0.5</float>
Set warm up time in seconds. If larger than 0 particle emitter starts with particles already simulated this many seconds.
particleEmitter.warmUpTime
or particleEmitter({id}).warmUpTime
<float name='particleEmitter.warmUpTime'>2</float>
Set particle emitter is casting particles.
particleEmitter.casting
or particleEmitter({id}).casting
<boolean name='particleEmitter.casting'>false</boolean>
Set position to attach resource to collider.
particleEmitter.position
or particleEmitter({id}).position
<vector name='particleEmitter.position' x='0' y='0' z='0.1'/>
Set orientation to attach resource to collider in degrees.
particleEmitter.orientation
or particleEmitter({id}).orientation
<vector name='particleEmitter.orientation' x='30' y='0' z='0'/>
Set bone to attach resource to. If empty string attach to collider.
particleEmitter.bone
or particleEmitter({id}).bone
<string name='particleEmitter.bone'>attach</string>
Set trigger casting. If no trigger is set the state of casting
property is used.
particleEmitter.trigger
or particleEmitter({id}).trigger
casting
<string name='particleEmitter.trigger'>@openHose & @waterInTank</string>
Set target casting. Fires target start casting and resets target if stop casting. Target can be used in triggers.
particleEmitter.targetCasting
or particleEmitter({id}).targetCasting
<string name='particleEmitter.targetCasting'>hoseSpouting</string>
Set target last particle died. Pulses target if the last particle died. This happens a certain amount of time after targetCasting
has been reset. Target can be used in triggers.
particleEmitter.targetLastParticleDied
or particleEmitter({id}).targetLastParticleDied
<string name='particleEmitter.targetLastParticleDied'>hoseSpoutEnd</string>
This behavior provides these events:
Start casting particles.
Stop casting particles.
Last particle of a burst emission died.
Determine response for a custom particle collision.
Listener can update provided collisionInfo
with the particle response to use. Multiple listeners can potentially update collisionInfo
. The last update is used. If no listener updates the information the particle will be destroyed.
This behavior adds these behavior tree actions if behavior tree is present. If behavior has non-empty identifier replace particleEmitter
with particleEmitter(id)
.
Set one or more particle emitter parameters.
Parameter | Value | Description |
---|---|---|
casting | true,false | Enable particle emitter casting |
This is an example of using this action:
<action name='particleEmitter.set'> <parameter name='casting'>true</parameter> </action>
Check one or more particle emitter parameters. Action succeeds if all parameter value matches their respective particle emitter parameter otherwise action fails. This action is typically used as first action in a sequence to run the sequence only if a particle emitter parameter matches (or not).
Parameter | Value | Description |
---|---|---|
casting | true,false | Particle emitter is casting or not |
This is an example of using this action:
<sequence> <action name='particleEmitter.check'> <parameter name='casting'>true</parameter> </action> <!-- actions here run only if particle emitter is casting --> </sequence>
This behavior adds these behavior tree conditions if behavior tree is present. If behavior has non-empty identifier replace particleEmitter
with particleEmitter(id)
.
Check one or more particle emitter parameters. Conditions returns true if all parameter value match their respective particle emitter parameter. This condition is typically used to run an action or sequence of actions as long as particle emitter conditions are true.
Parameter | Value | Description |
---|---|---|
particleEmitter.casting | true,false | Particle emitter is casting or not |
This is an example of using this condition:
<action name='myAction' id='doing something'> <parameter name='particleEmitter.casting'>true</parameter> <condition>particleEmitter.check</condition> </action>
Same as Behavior Tree Actions.
Same as Behavior Tree Conditions.
This behavior sends these state machine events. If behavior has non-empty identifier replace particleEmitter
with particleEmitter(id)
.
Start casting particles.
Stop casting particles.
Last particle of a burst emission died.
This behavior requires no other behaviors.
This behavior does support element class to be persistable (setPersistable). Saves selected color.
Since DragonScript Module Version 1.0
This example defines an element which contains a particle emitter.
class MyElement extends BehaviorElementClass public var ECBehaviorComponent component public var ECBehaviorCollider collider public var ECBehaviorParticleEmitter particleEmitter func new() component = ECBehaviorComponent.new(this, null) collider = ECBehaviorCollider.new(this, component) particleEmitter = ECBehaviorParticleEmitter.new(this, collider) particleEmitter.getParticleEmitter().getParticleEmitter().setPath("/content/emitters/water.depemit") 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='ECBehaviorComponent'/> <behavior type='ECBehaviorCollider'/> <behavior type='ECBehaviorParticleEmitter'> <!-- optional: set collision filter. default value '5:0 1 2 6' which means category BaseGameApp.CollisionFilterBit.particle filter BaseGameApp.CollisionFilterBit.geometry, BaseGameApp.CollisionFilterBit.dynamic, BaseGameApp.CollisionFilterBit.actor, BaseGameApp.CollisionFilterBit.forceField. format is '', 'category' or 'category:filter' where category and filter are a list of bits to set. --> <string name='collisionFilter'>5:0 1 2 6</string> <!-- optional: use BaseGameApp trigger table. game can add more supported values. default value is 'default'. --> <string name='triggerTable'>default</string> <!-- optional: sync trigger with particle emitter matching identifier --> <string name='syncTrigger'>second</string> <!-- optional: identifier of ECBehaviorTriggered to synchronize with or empty string to not synchronize. default is empty string. --> <string name='trigger.synchronize'>other</string> <!-- optional: use behavior tree with id instead of empty string --> <string name='behaviorTree'>second</string> <!-- optional: use state machine with id instead of empty string --> <string name='stateMachine'>second</string> <!-- set element properties. omit property prefix if used inside behavior tag --> <string name='.path'>water.depemit</string> </behavior> <!-- for adding multiple behaviors use unique identifiers --> <behavior type='ECBehaviorParticleEmitter' id='second'/> </elementClass>