|
Drag[en]gine Script Module DragonScript 1.35
|
Behavior element behavior play sound using one shot speaker. More...
Classes | |
| class | Factory |
| Behavior factory. More... | |
| class | Instance |
| Behavior instance. More... | |
Public Member Functions | |
| void | dispose () |
| Dispose of behavior. | |
| ECBehaviorBehaviorTree | getBehaviorTree () |
| Behavior tree or null. | |
| ECPString | getBone () |
| Name of bone to use to null if not used. | |
| ECBehaviorCollider | getCollider () |
| Collider behavior or null if not used. | |
| ECBehaviorComponent | getComponent () |
| Component behavior or null if not used. | |
| ECPFloat | getDistanceOffset () |
| Distance offset for attenuation calculation. | |
| LayerMask | getLayerMask () |
| ECPLayerMask | getLayerMaskProperty () |
| Layer mask property. | |
| ECPVector | getOrientation () |
| Orientation relative to element. | |
| ECPFloat | getPlaySpeed () |
| Play speed. | |
| ECPVector | getPosition () |
| Position relative to element. | |
| String | getPrefix () |
| Prefix. | |
| ECPFloat | getRange () |
| Speaker range. | |
| ECPFloat | getRollOff () |
| Half volume distance. | |
| ECPSound | getSound () |
| Speaker sound. | |
| ECPEnumeration | getSpeakerType () |
| Speaker type. | |
| ECBehaviorTriggered | getTrigger () |
| Trigger play sound. | |
| TSTriggerTable | getTriggerTable () |
| Trigger table or null if not used. | |
| ECPFloat | getVolume () |
| Speaker volume. | |
| Instance | instance (BehaviorElement element) |
| Get instance in element from owner element class. | |
| ECBehaviorPlaySound | new (BehaviorElementClass eclass, ECBehaviorComponent component, ECBehaviorCollider collider) |
| Create behavior element class. | |
| ECBehaviorPlaySound | new (BehaviorElementClass eclass, ECBehaviorComponent component, ECBehaviorCollider collider, String id) |
| Create behavior element class. | |
| ECBehaviorPlaySound | new (BehaviorElementClass eclass, ECBehaviorComponent component, ECBehaviorCollider collider, String id, String prefix) |
| Create behavior element class. | |
| ECBehaviorPlaySound | new (BehaviorElementClass eclass, ECBehaviorComponent component, ECBehaviorCollider collider, TSTriggerTable triggerTable) |
| Create behavior element class. | |
| ECBehaviorPlaySound | new (BehaviorElementClass eclass, ECBehaviorComponent component, ECBehaviorCollider collider, TSTriggerTable triggerTable, String id) |
| Create behavior element class. | |
| ECBehaviorPlaySound | new (BehaviorElementClass eclass, ECBehaviorComponent component, ECBehaviorCollider collider, TSTriggerTable triggerTable, String id, String subID) |
| ECBehaviorPlaySound | new (BehaviorElementClass eclass, ECBehaviorComponent component, ECBehaviorCollider collider, TSTriggerTable triggerTable, String id, String subID, String prefix) |
| void | set (String sound, float range, float volume) |
| Set to point speaker with parameters. | |
| void | set (String sound, float range, float volume, Vector position) |
| void | set (String sound, float range, float volume, Vector position, Vector orientation) |
| void | set (String sound, float range, float volume, Vector position, Vector orientation, String bone) |
| void | setBehaviorTree (ECBehaviorBehaviorTree behaviorTree) |
| Set behavior tree or null. | |
| void | setLayerMask (LayerMask layerMask) |
| Public Member Functions inherited from Dragengine.Scenery.DefaultECBehavior | |
| void | assignInstanceIndex (int instanceIndex) |
| Assign instance index. | |
| 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. | |
Static Public Member Functions | |
| static ECBehaviorPlaySound | getBehaviorIn (BehaviorElementClass eclass) |
| Get behavior in element class or null if absent. | |
Protected Member Functions | |
| void | setTriggerTable (TSTriggerTable triggerTable) |
| Set trigger table or null if not used. | |
| 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>". | |
Behavior element behavior play sound using one shot speaker.
Behavior is comparable to ECBehaviorSpeaker but does not add a permanent speaker to the element. Instead GWBehaviorOneShotSpeaker.addSpeaker() is used to play a short sound event. One shot speakers are constructed the same way as ECBehaviorSpeaker does. Once deployed the one shot speaker stays in place and vanishes once it finished playing. This is the preferred way to play short sound events like a door lock toggling or firing gun shots.
This behavior can be added multiple times to an element. This allows to play different sound events. Each instance has an identifier which can be used to retrieve a specific instance to play a one shot speaker. The prefix of the speaker class properties is "playSound." . If the identifier is not empty the speaker element class properties have the prefix "{id}.playSound." . This can be overwritten if required.
Hence to use more than one speaker use code like this in your subclass constructor:
You can now define the parameters to use for both speakers using for example the properties "volume" for the first speaker and "subPlaySound.volume" for the second speaker.
It is recommended to always specify an identifier even if only one speaker is used. This avoids potentially name conflicts especially if other behaviors are added attaching other resources too.
Typical parameters can be set quickly using ECBehaviorPlaySound.set() methods. This is an example of door element class playing a sound for opening and a sound for closing. Both sounds have a range of 30m and play at a volume of 0.8 and play at the center of the door. In XML element classes these sound parameters can be modified using "playSound.open.*" and "playSound.close.*".
Element class properties have the prefix "playSound{(id)}.".
If a trigger table is set the trigger expression "triggerPlay" or "{prefix}.triggerPlay" can be used to play sound each time the trigger expression changes and evaluates to true. Using a trigger table is usually only useful if the element can be used by mappers.
This behavior does not require the element class to be persistable (setPersistable).
| void Dragengine.Scenery.ECBehaviorPlaySound.dispose | ( | ) |
Dispose of behavior.
Reimplemented from Dragengine.Scenery.DefaultECBehavior.
References getRange(), and pRange.
Referenced by getBehaviorIn().
|
static |
Get behavior in element class or null if absent.
Use this method to check if a particular BehaviorElementClass contains a behavior of type ECBehaviorCollider.
References Dragengine.Scenery.ECBehavior.createInstance(), dispose(), getBehaviorIn(), getBehaviorTree(), getBone(), getCollider(), getComponent(), getDistanceOffset(), getLayerMask(), getLayerMaskProperty(), getOrientation(), getPlaySpeed(), getPosition(), getPrefix(), getRange(), getRollOff(), getSound(), getSpeakerType(), getTrigger(), getTriggerTable(), getVolume(), instance(), new(), pBehaviorTree, pBone, pCollider, pComponent, pDistanceOffset, pLayerMask, pOrientation, pPlaySpeed, pPosition, pPrefix, pRange, pRollOff, pSound, pSpeakerType, pTrigger, pTriggerTable, pVolume, set(), setBehaviorTree(), setLayerMask(), and setTriggerTable().
Referenced by getBehaviorIn().
| ECBehaviorBehaviorTree Dragengine.Scenery.ECBehaviorPlaySound.getBehaviorTree | ( | ) |
Behavior tree or null.
References getBone(), and pBone.
Referenced by getBehaviorIn(), and Dragengine.Scenery.ECBehaviorPlaySound.Instance.getDistanceOffset().
| ECPString Dragengine.Scenery.ECBehaviorPlaySound.getBone | ( | ) |
Name of bone to use to null if not used.
Referenced by getBehaviorIn(), and getBehaviorTree().
| ECBehaviorCollider Dragengine.Scenery.ECBehaviorPlaySound.getCollider | ( | ) |
| ECBehaviorComponent Dragengine.Scenery.ECBehaviorPlaySound.getComponent | ( | ) |
Component behavior or null if not used.
Referenced by getBehaviorIn(), and instance().
| ECPFloat Dragengine.Scenery.ECBehaviorPlaySound.getDistanceOffset | ( | ) |
Distance offset for attenuation calculation.
For use by distance sounds. Offsets the true distance to the sound source for attenuation calculation to make the sound appear coming from far away. Requires increasing the volume to compensate for the distance increased attenuation.
Referenced by getBehaviorIn(), and getRollOff().
| LayerMask Dragengine.Scenery.ECBehaviorPlaySound.getLayerMask | ( | ) |
| ECPLayerMask Dragengine.Scenery.ECBehaviorPlaySound.getLayerMaskProperty | ( | ) |
| ECPVector Dragengine.Scenery.ECBehaviorPlaySound.getOrientation | ( | ) |
Orientation relative to element.
References getPlaySpeed(), and pPlaySpeed.
Referenced by getBehaviorIn(), and getTriggerTable().
| ECPFloat Dragengine.Scenery.ECBehaviorPlaySound.getPlaySpeed | ( | ) |
Play speed.
Referenced by getBehaviorIn(), and getOrientation().
| ECPVector Dragengine.Scenery.ECBehaviorPlaySound.getPosition | ( | ) |
Position relative to element.
References pDistanceOffset.
Referenced by getBehaviorIn(), and getTrigger().
| String Dragengine.Scenery.ECBehaviorPlaySound.getPrefix | ( | ) |
Prefix.
References getRollOff(), and pRollOff.
Referenced by getBehaviorIn(), and Dragengine.Scenery.ECBehaviorPlaySound.Instance.getDistanceOffset().
| ECPFloat Dragengine.Scenery.ECBehaviorPlaySound.getRange | ( | ) |
Speaker range.
Referenced by dispose(), and getBehaviorIn().
| ECPFloat Dragengine.Scenery.ECBehaviorPlaySound.getRollOff | ( | ) |
Half volume distance.
References getDistanceOffset(), and pDistanceOffset.
Referenced by getBehaviorIn(), and getPrefix().
| ECPSound Dragengine.Scenery.ECBehaviorPlaySound.getSound | ( | ) |
| ECPEnumeration Dragengine.Scenery.ECBehaviorPlaySound.getSpeakerType | ( | ) |
Speaker type.
Referenced by getBehaviorIn().
| ECBehaviorTriggered Dragengine.Scenery.ECBehaviorPlaySound.getTrigger | ( | ) |
Trigger play sound.
References getPosition(), and pPlaySpeed.
Referenced by getBehaviorIn(), and set().
| TSTriggerTable Dragengine.Scenery.ECBehaviorPlaySound.getTriggerTable | ( | ) |
Trigger table or null if not used.
References getOrientation(), and pOrientation.
Referenced by getBehaviorIn(), and Dragengine.Scenery.ECBehaviorPlaySound.Instance.setRollOff().
| ECPFloat Dragengine.Scenery.ECBehaviorPlaySound.getVolume | ( | ) |
Speaker volume.
Referenced by getBehaviorIn(), and new().
| Instance Dragengine.Scenery.ECBehaviorPlaySound.instance | ( | BehaviorElement | element | ) |
Get instance in element from owner element class.
References getComponent(), pBone, and pComponent.
Referenced by getBehaviorIn(), Dragengine.Scenery.ECBehaviorPlaySound.Instance.getDistanceOffset(), Dragengine.Scenery.ECBehaviorPlaySound.Instance.getRollOff(), and Dragengine.Scenery.ECBehaviorPlaySound.Instance.setRollOff().
| ECBehaviorPlaySound Dragengine.Scenery.ECBehaviorPlaySound.new | ( | BehaviorElementClass | eclass, |
| ECBehaviorComponent | component, | ||
| ECBehaviorCollider | collider ) |
Create behavior element class.
These values are optional and can be null: component, collider.
Reimplemented in Dragengine.Scenery.ECBehaviorPlaySoundRandom.
References getSound(), and pSound.
Referenced by getBehaviorIn().
| ECBehaviorPlaySound Dragengine.Scenery.ECBehaviorPlaySound.new | ( | BehaviorElementClass | eclass, |
| ECBehaviorComponent | component, | ||
| ECBehaviorCollider | collider, | ||
| String | id ) |
Create behavior element class.
Reimplemented in Dragengine.Scenery.ECBehaviorPlaySoundRandom.
| ECBehaviorPlaySound Dragengine.Scenery.ECBehaviorPlaySound.new | ( | BehaviorElementClass | eclass, |
| ECBehaviorComponent | component, | ||
| ECBehaviorCollider | collider, | ||
| String | id, | ||
| String | prefix ) |
Create behavior element class.
Reimplemented in Dragengine.Scenery.ECBehaviorPlaySoundRandom.
References pSound.
| ECBehaviorPlaySound Dragengine.Scenery.ECBehaviorPlaySound.new | ( | BehaviorElementClass | eclass, |
| ECBehaviorComponent | component, | ||
| ECBehaviorCollider | collider, | ||
| TSTriggerTable | triggerTable ) |
Create behavior element class.
Reimplemented in Dragengine.Scenery.ECBehaviorPlaySoundRandom.
References getVolume().
| ECBehaviorPlaySound Dragengine.Scenery.ECBehaviorPlaySound.new | ( | BehaviorElementClass | eclass, |
| ECBehaviorComponent | component, | ||
| ECBehaviorCollider | collider, | ||
| TSTriggerTable | triggerTable, | ||
| String | id ) |
Create behavior element class.
Reimplemented in Dragengine.Scenery.ECBehaviorPlaySoundRandom.
References pVolume.
| ECBehaviorPlaySound Dragengine.Scenery.ECBehaviorPlaySound.new | ( | BehaviorElementClass | eclass, |
| ECBehaviorComponent | component, | ||
| ECBehaviorCollider | collider, | ||
| TSTriggerTable | triggerTable, | ||
| String | id, | ||
| String | subID ) |
Reimplemented in Dragengine.Scenery.ECBehaviorPlaySoundRandom.
| ECBehaviorPlaySound Dragengine.Scenery.ECBehaviorPlaySound.new | ( | BehaviorElementClass | eclass, |
| ECBehaviorComponent | component, | ||
| ECBehaviorCollider | collider, | ||
| TSTriggerTable | triggerTable, | ||
| String | id, | ||
| String | subID, | ||
| String | prefix ) |
Reimplemented in Dragengine.Scenery.ECBehaviorPlaySoundRandom.
References pVolume.
| void Dragengine.Scenery.ECBehaviorPlaySound.set | ( | String | sound, |
| float | range, | ||
| float | volume ) |
Set to point speaker with parameters.
Helper method to quickly set up playing sound.
Referenced by getBehaviorIn().
| void Dragengine.Scenery.ECBehaviorPlaySound.set | ( | String | sound, |
| float | range, | ||
| float | volume, | ||
| Vector | position ) |
References getTrigger(), and pTrigger.
| void Dragengine.Scenery.ECBehaviorPlaySound.set | ( | String | sound, |
| float | range, | ||
| float | volume, | ||
| Vector | position, | ||
| Vector | orientation ) |
| void Dragengine.Scenery.ECBehaviorPlaySound.set | ( | String | sound, |
| float | range, | ||
| float | volume, | ||
| Vector | position, | ||
| Vector | orientation, | ||
| String | bone ) |
| void Dragengine.Scenery.ECBehaviorPlaySound.setBehaviorTree | ( | ECBehaviorBehaviorTree | behaviorTree | ) |
Set behavior tree or null.
References pBone.
Referenced by Dragengine.Scenery.ECBehaviorPlaySoundRandom.Instance.createSpeaker(), getBehaviorIn(), and Dragengine.Scenery.ECBehaviorPlaySound.Instance.BTAPlay.runAction().
| void Dragengine.Scenery.ECBehaviorPlaySound.setLayerMask | ( | LayerMask | layerMask | ) |
|
protected |
| ECBehaviorBehaviorTree Dragengine.Scenery.ECBehaviorPlaySound.pBehaviorTree |
Referenced by getBehaviorIn().
| ECPString Dragengine.Scenery.ECBehaviorPlaySound.pBone |
Referenced by getBehaviorIn(), getBehaviorTree(), instance(), and setBehaviorTree().
| ECBehaviorCollider Dragengine.Scenery.ECBehaviorPlaySound.pCollider |
Referenced by getBehaviorIn().
| ECBehaviorComponent Dragengine.Scenery.ECBehaviorPlaySound.pComponent |
Referenced by getBehaviorIn(), and instance().
| ECPFloat Dragengine.Scenery.ECBehaviorPlaySound.pDistanceOffset |
Referenced by getBehaviorIn(), getPosition(), and getRollOff().
| ECPLayerMask Dragengine.Scenery.ECBehaviorPlaySound.pLayerMask |
Referenced by getBehaviorIn().
| ECPVector Dragengine.Scenery.ECBehaviorPlaySound.pOrientation |
Referenced by getBehaviorIn(), getTriggerTable(), and setTriggerTable().
| ECPFloat Dragengine.Scenery.ECBehaviorPlaySound.pPlaySpeed |
Referenced by getBehaviorIn(), getOrientation(), and getTrigger().
| ECPVector Dragengine.Scenery.ECBehaviorPlaySound.pPosition |
Referenced by getBehaviorIn(), getLayerMask(), and getLayerMaskProperty().
| String Dragengine.Scenery.ECBehaviorPlaySound.pPrefix |
Referenced by getBehaviorIn().
| ECPFloat Dragengine.Scenery.ECBehaviorPlaySound.pRange |
Referenced by dispose(), getBehaviorIn(), and getCollider().
| ECPFloat Dragengine.Scenery.ECBehaviorPlaySound.pRollOff |
Referenced by getBehaviorIn(), getPrefix(), and getSound().
| ECPSound Dragengine.Scenery.ECBehaviorPlaySound.pSound |
Referenced by getBehaviorIn(), new(), and new().
| ECPEnumeration Dragengine.Scenery.ECBehaviorPlaySound.pSpeakerType |
Referenced by getBehaviorIn().
| ECBehaviorTriggered Dragengine.Scenery.ECBehaviorPlaySound.pTrigger |
Referenced by getBehaviorIn(), and set().
| TSTriggerTable Dragengine.Scenery.ECBehaviorPlaySound.pTriggerTable |
Referenced by getBehaviorIn().
| ECPFloat Dragengine.Scenery.ECBehaviorPlaySound.pVolume |
Referenced by getBehaviorIn(), new(), and new().