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

Default implementation of GWBehavior doing nothing. More...

Inheritance diagram for Dragengine.Scenery.DefaultGWBehavior:
Dragengine.Scenery.GWBehavior Dragengine.Scenery.GWBehaviorAnchoredElements Dragengine.Scenery.GWBehaviorBTSM Dragengine.Scenery.GWBehaviorOneShotSpeaker Dragengine.Scenery.GWBehaviorParameterTree

Public Member Functions

void dispose ()
 Dispose of behavior.
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)
 Create default behavior with empty identifier.
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.

Protected Member Functions

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

Default implementation of GWBehavior doing nothing.

Version
1.17

Member Function Documentation

◆ dispose()

void Dragengine.Scenery.DefaultGWBehavior.dispose ( )

◆ getBehaviorID()

String Dragengine.Scenery.DefaultGWBehavior.getBehaviorID ( )

Unique identifier of behavior.

Has to return a string which is unique in the owner GameWorld. This string will be stored. This allows to assign restored behavior data to the correct behavior if present.

The default implementation returns "<class-name>:<identifier>" or "<class-name>" if identifier is empty string (constructor calls useClassNameAsBehaviorID()). If two or more behaviors share the same class name you have to make sure getBehaviorID() returns unique names. This can be done using one of these possible ways:

Implements Dragengine.Scenery.GWBehavior.

Referenced by useClassNameAsBehaviorID().

◆ getGameWorld()

◆ getID()

String Dragengine.Scenery.DefaultGWBehavior.getID ( )

Identifier.

Referenced by getGameWorld().

◆ init()

void Dragengine.Scenery.DefaultGWBehavior.init ( StubGameWorld stub)

Initialize game world from stub.

Implements Dragengine.Scenery.GWBehavior.

Reimplemented in Dragengine.Scenery.GWBehaviorBTSM, and Dragengine.Scenery.GWBehaviorParameterTree.

References new().

Referenced by writeToFile().

◆ loadSupportedData()

void Dragengine.Scenery.DefaultGWBehavior.loadSupportedData ( String identifier,
PersistencyEnvironment env,
FileReader reader )

Load data of another behavior.

Called if supportsBehaviorID(String) returns true for identifier. GameWorld requests behavior to load the supported data block.

Implements Dragengine.Scenery.GWBehavior.

References loadSupportedData(), new(), postThink(), readFromFile(), requiresPersistency(), setRequiresPersistency(), supportsBehaviorID(), think(), update(), and writeToFile().

Referenced by loadSupportedData().

◆ new() [1/2]

◆ new() [2/2]

DefaultGWBehavior Dragengine.Scenery.DefaultGWBehavior.new ( GameWorld gameWorld,
String id )

Create default behavior.

References new().

◆ postThink()

void Dragengine.Scenery.DefaultGWBehavior.postThink ( float elapsed)

Post thinking after physics processing is finished.

Post think is called first on all elements then on all behaviors.

Implements Dragengine.Scenery.GWBehavior.

References useFullyQualifiedClassNameAsBehaviorID().

Referenced by Dragengine.Scenery.GWBehaviorOneShotSpeaker.getBehaviorIn(), and loadSupportedData().

◆ readFromFile()

void Dragengine.Scenery.DefaultGWBehavior.readFromFile ( PersistencyEnvironment env,
FileReader reader )

Read from file.

Implements Dragengine.Scenery.GWBehavior.

Referenced by loadSupportedData().

◆ requiresPersistency()

bool Dragengine.Scenery.DefaultGWBehavior.requiresPersistency ( )

Behavior requires readFromFile() and writeToFile() to be called.

Implements Dragengine.Scenery.GWBehavior.

Referenced by loadSupportedData().

◆ requiresThink()

bool Dragengine.Scenery.DefaultGWBehavior.requiresThink ( )

Behavior instance requires update(), think() and postThink() to be called.

Implements Dragengine.Scenery.GWBehavior.

Referenced by writeToFile().

◆ setBehaviorID()

void Dragengine.Scenery.DefaultGWBehavior.setBehaviorID ( String identifier)
protected

Set behavior identifier.

Note
Call this only during the constructor. Behavior identifier has to be static during the entire life time of the behavior.

Referenced by useFullyQualifiedClassNameAsBehaviorID().

◆ setRequiresPersistency()

void Dragengine.Scenery.DefaultGWBehavior.setRequiresPersistency ( bool required)
protected

Set if behavior requires readFromFile() and writeToFile() to be called.

Referenced by loadSupportedData().

◆ setRequiresThink()

void Dragengine.Scenery.DefaultGWBehavior.setRequiresThink ( bool required)
protected

Set if behavior instance requires update(), think() and postThink() to be called.

Referenced by Dragengine.Scenery.GWBehaviorOneShotSpeaker.dispose(), and writeToFile().

◆ supportsBehaviorID()

bool Dragengine.Scenery.DefaultGWBehavior.supportsBehaviorID ( String identifier)

Behavior supports loading data of another behavior.

Returns true if this behavior supports loading data of another behavior matching behavior identifier. Called for all behaviors if GameWorld encounters a data block with a behavior identifier not matching any behaviors.

Implements Dragengine.Scenery.GWBehavior.

Referenced by loadSupportedData().

◆ think()

void Dragengine.Scenery.DefaultGWBehavior.think ( float elapsed)

Think about what to do for the next frame update.

Think is called first on all behaviors then on all elements.

Implements Dragengine.Scenery.GWBehavior.

Referenced by loadSupportedData().

◆ update()

void Dragengine.Scenery.DefaultGWBehavior.update ( float elapsed)

Frame update.

Update is called on behaviors before enter frame and world updating is called.

Implements Dragengine.Scenery.GWBehavior.

References useClassNameAsBehaviorID().

Referenced by loadSupportedData().

◆ useClassNameAsBehaviorID()

void Dragengine.Scenery.DefaultGWBehavior.useClassNameAsBehaviorID ( )
protected

Set behavior identifier to "<class-name>:<identifier>".

If identifier is empty string omits the double-colon.

Note
Call this only during the constructor. Behavior identifier has to be static during the entire life time of the behavior.

References getBehaviorID().

Referenced by getGameWorld(), and update().

◆ useFullyQualifiedClassNameAsBehaviorID()

void Dragengine.Scenery.DefaultGWBehavior.useFullyQualifiedClassNameAsBehaviorID ( )
protected

Set behavior identifier to "<fully-qualified-class-name>:<identifier>".

If identifier is empty string omits the double-colon.

Note
Call this only during the constructor. Behavior identifier has to be static during the entire life time of the behavior.

References new(), and setBehaviorID().

Referenced by postThink().

◆ writeToFile()

void Dragengine.Scenery.DefaultGWBehavior.writeToFile ( PersistencyEnvironment env,
FileWriter writer )

Write to file.

Implements Dragengine.Scenery.GWBehavior.

References init(), requiresThink(), and setRequiresThink().

Referenced by loadSupportedData().


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