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

GameWorld Behavior adding support for one-shot speakers. More...

Inheritance diagram for Dragengine.Scenery.GWBehaviorOneShotSpeaker:
Dragengine.Scenery.DefaultGWBehavior Dragengine.Scenery.GWBehavior

Public Member Functions

void addSpeaker (Speaker speaker)
 Add one shot speaker.
void dispose ()
 Dispose of behavior.
LayerMask getLayerMask ()
 Layer mask to use for one shot speaker.
Speaker getSpeakerAt (int index)
 Speaker at index.
int getSpeakerCount ()
 Count of speakers.
GWBehaviorOneShotSpeaker new (GameWorld gameWorld)
 Create element.
void playSoundOnce (Sound sound, DVector position, float volume, float range)
 Play sound once.
void playSoundOnce (Sound sound, DVector position, Quaternion orientation, float volume, float range)
 Play sound once.
void playSoundOnce (Sound sound, Element element, float volume, float range)
 Play sound once.
void playSynthesizerOnce (SynthesizerInstance synthesizer, DVector position, float volume, float range)
 Play synthesizer instance once.
void playSynthesizerOnce (SynthesizerInstance synthesizer, DVector position, Quaternion orientation, float volume, float range)
 Play synthesizer instance once.
void playSynthesizerOnce (SynthesizerInstance synthesizer, Element element, float volume, float range)
 Play synthesizer instance once.
void removeFinishedSpeakers ()
 Remove one shot speakers that finished playing.
void setLayerMask (LayerMask layerMask)
 Set layer mask to use for one shot speaker.
Public Member Functions inherited from Dragengine.Scenery.DefaultGWBehavior
String getBehaviorID ()
 Unique identifier of behavior.
GameWorld getGameWorld ()
 Game world this behavior belongs to.
String getID ()
 Identifier.
void init (StubGameWorld stub)
 Initialize game world from stub.
void loadSupportedData (String identifier, PersistencyEnvironment env, FileReader reader)
 Load data of another behavior.
DefaultGWBehavior new (GameWorld gameWorld, String id)
 Create default behavior.
void postThink (float elapsed)
 Post thinking after physics processing is finished.
void readFromFile (PersistencyEnvironment env, FileReader reader)
 Read from file.
bool requiresPersistency ()
 Behavior requires readFromFile() and writeToFile() to be called.
bool requiresThink ()
 Behavior instance requires update(), think() and postThink() to be called.
bool supportsBehaviorID (String identifier)
 Behavior supports loading data of another behavior.
void think (float elapsed)
 Think about what to do for the next frame update.
void update (float elapsed)
 Frame update.
void writeToFile (PersistencyEnvironment env, FileWriter writer)
 Write to file.

Static Public Member Functions

static GWBehaviorOneShotSpeaker getBehaviorIn (GameWorld gameWorld)
 Get behavior in game world or null if absent.

Public Attributes

LayerMask pLayerMask
Array pSpeakers

Additional Inherited Members

Protected Member Functions inherited from Dragengine.Scenery.DefaultGWBehavior
void setBehaviorID (String identifier)
 Set behavior identifier.
void setRequiresPersistency (bool required)
 Set if behavior requires readFromFile() and writeToFile() to be called.
void setRequiresThink (bool required)
 Set if behavior instance requires update(), think() and postThink() to be called.
void useClassNameAsBehaviorID ()
 Set behavior identifier to "<class-name>:<identifier>".
void useFullyQualifiedClassNameAsBehaviorID ()
 Set behavior identifier to "<fully-qualified-class-name>:<identifier>".

Detailed Description

GameWorld Behavior adding support for one-shot speakers.

Version
1.17

One shot speakers are deploy-and-forget type speakers playing a sound or synthesizer once then self-destroy.

This behavior can be present only once in a GameWorld.

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

Member Function Documentation

◆ addSpeaker()

void Dragengine.Scenery.GWBehaviorOneShotSpeaker.addSpeaker ( Speaker speaker)

Add one shot speaker.

Plays a short sound once and will be deleted once finished playing.

References new(), and pLayerMask.

Referenced by getBehaviorIn(), and playSoundOnce().

◆ dispose()

void Dragengine.Scenery.GWBehaviorOneShotSpeaker.dispose ( )

◆ getBehaviorIn()

GWBehaviorOneShotSpeaker Dragengine.Scenery.GWBehaviorOneShotSpeaker.getBehaviorIn ( GameWorld gameWorld)
static

◆ getLayerMask()

LayerMask Dragengine.Scenery.GWBehaviorOneShotSpeaker.getLayerMask ( )

Layer mask to use for one shot speaker.

References dispose(), and pSpeakers.

Referenced by getSpeakerAt().

◆ getSpeakerAt()

Speaker Dragengine.Scenery.GWBehaviorOneShotSpeaker.getSpeakerAt ( int index)

Speaker at index.

References getLayerMask(), pLayerMask, and setLayerMask().

Referenced by playSoundOnce().

◆ getSpeakerCount()

int Dragengine.Scenery.GWBehaviorOneShotSpeaker.getSpeakerCount ( )

Count of speakers.

Referenced by playSoundOnce().

◆ new()

GWBehaviorOneShotSpeaker Dragengine.Scenery.GWBehaviorOneShotSpeaker.new ( GameWorld gameWorld)

Create element.

Reimplemented from Dragengine.Scenery.DefaultGWBehavior.

References new(), pLayerMask, and pSpeakers.

Referenced by addSpeaker(), getBehaviorIn(), and new().

◆ playSoundOnce() [1/3]

void Dragengine.Scenery.GWBehaviorOneShotSpeaker.playSoundOnce ( Sound sound,
DVector position,
float volume,
float range )

Play sound once.

Create speaker with sound and parameters playing it once. Does nothing if sound is null.

◆ playSoundOnce() [2/3]

void Dragengine.Scenery.GWBehaviorOneShotSpeaker.playSoundOnce ( Sound sound,
DVector position,
Quaternion orientation,
float volume,
float range )

Play sound once.

Create speaker with sound and parameters playing it once. Does nothing if sound is null.

References addSpeaker(), Dragengine.Scenery.DefaultGWBehavior.getGameWorld(), and pSpeakers.

◆ playSoundOnce() [3/3]

void Dragengine.Scenery.GWBehaviorOneShotSpeaker.playSoundOnce ( Sound sound,
Element element,
float volume,
float range )

Play sound once.

Create speaker with sound and parameters playing it once. Does nothing if sound is null.

References getSpeakerAt(), getSpeakerCount(), and pSpeakers.

Referenced by playSynthesizerOnce(), playSynthesizerOnce(), playSynthesizerOnce(), and removeFinishedSpeakers().

◆ playSynthesizerOnce() [1/3]

void Dragengine.Scenery.GWBehaviorOneShotSpeaker.playSynthesizerOnce ( SynthesizerInstance synthesizer,
DVector position,
float volume,
float range )

Play synthesizer instance once.

Create speaker with synthesizer instance and parameters playing it once. Does nothing if synthesizer is null.

References playSoundOnce().

◆ playSynthesizerOnce() [2/3]

void Dragengine.Scenery.GWBehaviorOneShotSpeaker.playSynthesizerOnce ( SynthesizerInstance synthesizer,
DVector position,
Quaternion orientation,
float volume,
float range )

Play synthesizer instance once.

Create speaker with synthesizer instance and parameters playing it once. Does nothing if synthesizer is null.

References playSoundOnce().

◆ playSynthesizerOnce() [3/3]

void Dragengine.Scenery.GWBehaviorOneShotSpeaker.playSynthesizerOnce ( SynthesizerInstance synthesizer,
Element element,
float volume,
float range )

Play synthesizer instance once.

Create speaker with synthesizer instance and parameters playing it once. Does nothing if synthesizer is null.

References playSoundOnce().

Referenced by getBehaviorIn().

◆ removeFinishedSpeakers()

void Dragengine.Scenery.GWBehaviorOneShotSpeaker.removeFinishedSpeakers ( )

Remove one shot speakers that finished playing.

References playSoundOnce().

Referenced by getBehaviorIn().

◆ setLayerMask()

void Dragengine.Scenery.GWBehaviorOneShotSpeaker.setLayerMask ( LayerMask layerMask)

Set layer mask to use for one shot speaker.

References dispose().

Referenced by getBehaviorIn(), and getSpeakerAt().

Member Data Documentation

◆ pLayerMask

LayerMask Dragengine.Scenery.GWBehaviorOneShotSpeaker.pLayerMask

Referenced by addSpeaker(), getSpeakerAt(), and new().

◆ pSpeakers

Array Dragengine.Scenery.GWBehaviorOneShotSpeaker.pSpeakers

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