Drag[en]gine Script Module DragonScript
1.23
|
Default implementation of GWBehavior doing nothing. More...
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... | |
Default implementation of GWBehavior doing nothing.
void Dragengine.Scenery.DefaultGWBehavior.dispose | ( | ) |
Dispose of behavior.
Implements Dragengine.Scenery.GWBehavior.
Reimplemented in Dragengine.Scenery.GWBehaviorOneShotSpeaker.
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.
GameWorld Dragengine.Scenery.DefaultGWBehavior.getGameWorld | ( | ) |
Game world this behavior belongs to.
Implements Dragengine.Scenery.GWBehavior.
String Dragengine.Scenery.DefaultGWBehavior.getID | ( | ) |
Identifier.
void Dragengine.Scenery.DefaultGWBehavior.init | ( | StubGameWorld | stub | ) |
Initialize game world from stub.
Implements Dragengine.Scenery.GWBehavior.
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.
DefaultGWBehavior Dragengine.Scenery.DefaultGWBehavior.new | ( | GameWorld | gameWorld | ) |
Create default behavior with empty identifier.
Reimplemented in Dragengine.Scenery.GWBehaviorOneShotSpeaker.
DefaultGWBehavior Dragengine.Scenery.DefaultGWBehavior.new | ( | GameWorld | gameWorld, |
String | id | ||
) |
Create default behavior.
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.
void Dragengine.Scenery.DefaultGWBehavior.readFromFile | ( | PersistencyEnvironment | env, |
FileReader | reader | ||
) |
Read from file.
Implements Dragengine.Scenery.GWBehavior.
bool Dragengine.Scenery.DefaultGWBehavior.requiresPersistency | ( | ) |
Behavior requires readFromFile() and writeToFile() to be called.
Implements Dragengine.Scenery.GWBehavior.
bool Dragengine.Scenery.DefaultGWBehavior.requiresThink | ( | ) |
Behavior instance requires update(), think() and postThink() to be called.
Implements Dragengine.Scenery.GWBehavior.
|
protected |
Set behavior identifier.
|
protected |
Set if behavior requires readFromFile() and writeToFile() to be called.
|
protected |
Set if behavior instance requires update(), think() and postThink() to be called.
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.
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.
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.
|
protected |
Set behavior identifier to "<class-name>:<identifier>".
If identifier is empty string omits the double-colon.
|
protected |
Set behavior identifier to "<fully-qualified-class-name>:<identifier>".
If identifier is empty string omits the double-colon.
void Dragengine.Scenery.DefaultGWBehavior.writeToFile | ( | PersistencyEnvironment | env, |
FileWriter | writer | ||
) |
Write to file.
Implements Dragengine.Scenery.GWBehavior.