Drag[en]gine Script Module DragonScript  1.23
Dragengine.Scenery.DefaultGWBehavior Class Reference

Default implementation of GWBehavior doing nothing. More...

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

Public Member Functions

void dispose ()
 Dispose of behavior. More...
 
String getBehaviorID ()
 Unique identifier of behavior. More...
 
GameWorld getGameWorld ()
 Game world this behavior belongs to. More...
 
String getID ()
 Identifier. More...
 
void init (StubGameWorld stub)
 Initialize game world from stub. More...
 
void loadSupportedData (String identifier, PersistencyEnvironment env, FileReader reader)
 Load data of another behavior. More...
 
DefaultGWBehavior new (GameWorld gameWorld)
 Create default behavior with empty identifier. More...
 
DefaultGWBehavior new (GameWorld gameWorld, String id)
 Create default behavior. More...
 
void postThink (float elapsed)
 Post thinking after physics processing is finished. More...
 
void readFromFile (PersistencyEnvironment env, FileReader reader)
 Read from file. More...
 
bool requiresPersistency ()
 Behavior requires readFromFile() and writeToFile() to be called. More...
 
bool requiresThink ()
 Behavior instance requires update(), think() and postThink() to be called. More...
 
bool supportsBehaviorID (String identifier)
 Behavior supports loading data of another behavior. More...
 
void think (float elapsed)
 Think about what to do for the next frame update. More...
 
void update (float elapsed)
 Frame update. More...
 
void writeToFile (PersistencyEnvironment env, FileWriter writer)
 Write to file. More...
 

Protected Member Functions

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

Detailed Description

Default implementation of GWBehavior doing nothing.

Version
1.17

Member Function Documentation

◆ dispose()

void Dragengine.Scenery.DefaultGWBehavior.dispose ( )

Dispose of behavior.

Implements Dragengine.Scenery.GWBehavior.

Reimplemented in Dragengine.Scenery.GWBehaviorOneShotSpeaker.

◆ 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.

◆ getGameWorld()

GameWorld Dragengine.Scenery.DefaultGWBehavior.getGameWorld ( )

Game world this behavior belongs to.

Implements Dragengine.Scenery.GWBehavior.

◆ getID()

String Dragengine.Scenery.DefaultGWBehavior.getID ( )

Identifier.

◆ init()

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

Initialize game world from stub.

Implements Dragengine.Scenery.GWBehavior.

◆ 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.

◆ new() [1/2]

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

Create default behavior with empty identifier.

Reimplemented in Dragengine.Scenery.GWBehaviorOneShotSpeaker.

◆ new() [2/2]

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

Create default behavior.

◆ 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.

◆ readFromFile()

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

Read from file.

Implements Dragengine.Scenery.GWBehavior.

◆ requiresPersistency()

bool Dragengine.Scenery.DefaultGWBehavior.requiresPersistency ( )

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

Implements Dragengine.Scenery.GWBehavior.

◆ requiresThink()

bool Dragengine.Scenery.DefaultGWBehavior.requiresThink ( )

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

Implements Dragengine.Scenery.GWBehavior.

◆ 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.

◆ setRequiresPersistency()

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

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

◆ setRequiresThink()

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

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

◆ 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.

◆ 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.

◆ 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.

◆ 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.

◆ 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.

◆ writeToFile()

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

Write to file.

Implements Dragengine.Scenery.GWBehavior.


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