Drag[en]gine Script Module DragonScript Script API  1.0
GameWorld Class Reference
Inheritance diagram for GameWorld:

Public Member Functions

void addElement (Element element)
 
void addOneShotSpeaker (Speaker speaker)
 Add one shot speaker. More...
 
void dispose ()
 
void forEachElement (Block ablock)
 
CachedVegetation getCachedVegetation ()
 
TemporaryDecalManager getTemporaryDecalManager ()
 
World getWorld ()
 
bool hasElement (Element element)
 
GameWorld new ()
 
void playSoundOnce (Sound sound, Element element, float volume, float range)
 Play sound once. More...
 
void playSoundOnce (Sound sound, DVector position, float volume, float range)
 Play sound once. More...
 
void playSoundOnce (Sound sound, DVector position, Quaternion orientation, float volume, float range)
 Play sound once. More...
 
void playSynthesizerOnce (SynthesizerInstance synthesizer, Element element, float volume, float range)
 Play synthesizer instance once. More...
 
void playSynthesizerOnce (SynthesizerInstance synthesizer, DVector position, float volume, float range)
 Play synthesizer instance once. More...
 
void playSynthesizerOnce (SynthesizerInstance synthesizer, DVector position, Quaternion orientation, float volume, float range)
 Play synthesizer instance once. More...
 
void postLoadInit ()
 
void postThink (float elapsed)
 
void processElements (ElementProcessor processor)
 
void readElementsFromFile (FileReader reader, ElementClassManager eclsmgr)
 
void readFromFile (FileReader reader, ElementClassManager eclsmgr)
 
void removeAllElements ()
 
void removeElement (Element element)
 
void setCachedVegetation (CachedVegetation cachedVegetation)
 
void setTemporaryDecalManager (TemporaryDecalManager manager)
 
void think (float elapsed)
 
void update (float elapsed)
 
void visitElements (ElementVisitor visitor)
 
void writeElementsToFile (FileWriter writer)
 
void writeToFile (FileWriter writer)
 

Detailed Description

A game world is a single simulation unit in the game. Simple games require usually only one game world containing all elements of the currently loaded map or level. More complex games can use multiple game worlds for example to simulate development of the game world outside the currently visible section. Every game world wraps an engine world resource. Elements removed from the game world using removeElement are not disposed of. This allows to move elements between game worlds. Elements removed using removeAllElements though get disposed.

Author
Roland Pl├╝ss
Version
1.0

Member Function Documentation

§ addElement()

void addElement ( Element  element)

Add Element.

§ addOneShotSpeaker()

void addOneShotSpeaker ( Speaker  speaker)

Add one shot speaker.

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

§ dispose()

void dispose ( )

Disposes of the game world. Used to unset all cross-links that would litter memory.

§ forEachElement()

void forEachElement ( Block  ablock)

Visits elements in a non-safe way.

§ getCachedVegetation()

CachedVegetation getCachedVegetation ( )

Retrieves the cached vegetation.

§ getTemporaryDecalManager()

TemporaryDecalManager getTemporaryDecalManager ( )

Retrieves the temporary decals manager.

§ getWorld()

World getWorld ( )

Retrieves the engine world resource.

§ hasElement()

bool hasElement ( Element  element)

Checks if the given element exists.

§ new()

GameWorld new ( )

Creates a new game world.

§ playSoundOnce() [1/3]

void playSoundOnce ( Sound  sound,
Element  element,
float  volume,
float  range 
)

Play sound once.

Creates a speaker with the sound and parameters playing it once. If sound it null nothing is done.

§ playSoundOnce() [2/3]

void playSoundOnce ( Sound  sound,
DVector  position,
float  volume,
float  range 
)

Play sound once.

Creates a speaker with the sound and parameters playing it once. If sound it null nothing is done.

§ playSoundOnce() [3/3]

void playSoundOnce ( Sound  sound,
DVector  position,
Quaternion  orientation,
float  volume,
float  range 
)

Play sound once.

Creates a speaker with the sound and parameters playing it once. If sound it null nothing is done.

§ playSynthesizerOnce() [1/3]

void playSynthesizerOnce ( SynthesizerInstance  synthesizer,
Element  element,
float  volume,
float  range 
)

Play synthesizer instance once.

Creates speaker with synthesizer instance and parameters playing it once. If synthesizer is null nothing is done.

§ playSynthesizerOnce() [2/3]

void playSynthesizerOnce ( SynthesizerInstance  synthesizer,
DVector  position,
float  volume,
float  range 
)

Play synthesizer instance once.

Creates speaker with synthesizer instance and parameters playing it once. If synthesizer is null nothing is done.

§ playSynthesizerOnce() [3/3]

void playSynthesizerOnce ( SynthesizerInstance  synthesizer,
DVector  position,
Quaternion  orientation,
float  volume,
float  range 
)

Play synthesizer instance once.

Creates speaker with synthesizer instance and parameters playing it once. If synthesizer is null nothing is done.

§ postLoadInit()

void postLoadInit ( )

Do a post load init on all elements.

§ postThink()

void postThink ( float  elapsed)

Make elements think after physics simulation.

§ processElements()

void processElements ( ElementProcessor  processor)

Process all elements.

§ readElementsFromFile()

void readElementsFromFile ( FileReader  reader,
ElementClassManager  eclsmgr 
)

Reads elements from a file. Creates elements from element classes using loadAndAddElement.

§ readFromFile()

void readFromFile ( FileReader  reader,
ElementClassManager  eclsmgr 
)

Reads the world from a file.

§ removeAllElements()

void removeAllElements ( )

Remove all Elements from scenario disposing them.

§ removeElement()

void removeElement ( Element  element)

Remove Element from scenario without disposing it.

§ setCachedVegetation()

void setCachedVegetation ( CachedVegetation  cachedVegetation)

Sets the cached vegetation.

§ setTemporaryDecalManager()

void setTemporaryDecalManager ( TemporaryDecalManager  manager)

Sets the temporary decals manager.

§ think()

void think ( float  elapsed)

Make elements think.

§ update()

void update ( float  elapsed)

Update the game world for rendering later on. Update a game world once at the beginning of a Frame Update cycle. You can then render the game world as many times as you wish.

§ visitElements()

void visitElements ( ElementVisitor  visitor)

Visits all elements.

§ writeElementsToFile()

void writeElementsToFile ( FileWriter  writer)

Writes all elements to a file which have no parents and whose element class is marked to be loading upon loading/connecting. Elements with parents have to be written by their parents. This avoids the need for a unique numbering system.

§ writeToFile()

void writeToFile ( FileWriter  writer)

Writes the world to a file. The default implementation calls writeElementsToFile to write all elements to the file.


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