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

Default implementation of ECAttachableBehavior doing nothing. More...

Inheritance diagram for Dragengine.Scenery.DefaultECAttachableBehavior:
Dragengine.Debugging.DebugBehaviorVRHandPose

Public Member Functions

void addToGameWorld ()
 
void attachToParent (Element parent)
 
void dispose ()
 
void enterFrame ()
 
void geometryChanged ()
 
BehaviorElement getElement ()
 
DefaultECAttachableBehavior new ()
 Create default attachable behavior instance. More...
 
void onAddToElement ()
 Behavior has been added to element. More...
 
void onRemoveFromElement ()
 Behavior has been removed from element. More...
 
String persistencyFactoryName ()
 
void postThink (float elapsed)
 
void removeFromGameWorld ()
 
bool requiresEnterFrame ()
 
bool requiresThink ()
 
void safeDispose ()
 Remove from element if present then call dispose(). More...
 
void setElement (BehaviorElement element)
 
void stateChanged ()
 
void think (float elapsed)
 
void writeObjectToFile (PersistencyEnvironment env, FileWriter writer)
 

Public Attributes

BehaviorElement pElement
 
bool pRequiresEnterFrame
 
bool pRequiresThink
 

Protected Member Functions

void setRequiresEnterFrame (bool required)
 Set if behavior instance requires enterFrame() to be called. More...
 
void setRequiresThink (bool required)
 Set if behavior instance requires think() and postThink() to be called. More...
 

Detailed Description

Default implementation of ECAttachableBehavior doing nothing.

Version
1.23

The defaut implementation of persistencyFactoryName() returns null. BehaviorElement does not persist attachable behaviors returning null as persistency factory name.

If you want to persist the behavior implement a factory and overwrite persistencyFactoryName() returning the factory name. The writeObjectToFile() writes by default a 0 byte (version byte) to allow easy expansion in future revisions.

An example factor implementation looks like this:

class Factory implements PersistencyFactory
public static fixed var String name = "MyAttachableBehavior"
func new()
end
func Persistable readObjectFromFile(PersistencyEnvironment env, FileReader reader)
return MyAttachableBehavior.new(env, reader)
end
end
DefaultECAttachableBehavior new()
Create default attachable behavior instance.

You need then also an implementation of MyAttachableBehavior.new(PersistencyEnvironment env, FileReader reader) like this:

func new(PersistencyEnvironment env, FileReader reader)
if reader.readByte() != 0 // version byte written by writeObjectToFile()
throw EInvalidParam.new("unsupported version")
end
end

The default implementation of writeObjectToFile writes a single 0 value byte (version byte) to allow easy extension of the behavior in future revisions.

Also do not forget to add your factory to the game wide persistency factory list in BaseGameApp.registerPersistencyFactories() like this:

persistency.addFactory(MyAttachableBehavior.Factory.name, MyAttachableBehavior.Factory.new())

Member Function Documentation

◆ addToGameWorld()

void Dragengine.Scenery.DefaultECAttachableBehavior.addToGameWorld ( )

◆ attachToParent()

void Dragengine.Scenery.DefaultECAttachableBehavior.attachToParent ( Element  parent)

◆ dispose()

void Dragengine.Scenery.DefaultECAttachableBehavior.dispose ( )

◆ enterFrame()

void Dragengine.Scenery.DefaultECAttachableBehavior.enterFrame ( )

◆ geometryChanged()

void Dragengine.Scenery.DefaultECAttachableBehavior.geometryChanged ( )

◆ getElement()

BehaviorElement Dragengine.Scenery.DefaultECAttachableBehavior.getElement ( )

◆ new()

DefaultECAttachableBehavior Dragengine.Scenery.DefaultECAttachableBehavior.new ( )

Create default attachable behavior instance.

◆ onAddToElement()

void Dragengine.Scenery.DefaultECAttachableBehavior.onAddToElement ( )

Behavior has been added to element.

Called by setElement() after element has been set in these situations:

Reimplemented in Dragengine.Debugging.DebugBehaviorVRHandPose.

◆ onRemoveFromElement()

void Dragengine.Scenery.DefaultECAttachableBehavior.onRemoveFromElement ( )

Behavior has been removed from element.

Called by setElement() before element is set to null in these situations:

Reimplemented in Dragengine.Debugging.DebugBehaviorVRHandPose.

◆ persistencyFactoryName()

String Dragengine.Scenery.DefaultECAttachableBehavior.persistencyFactoryName ( )

◆ postThink()

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

◆ removeFromGameWorld()

void Dragengine.Scenery.DefaultECAttachableBehavior.removeFromGameWorld ( )

◆ requiresEnterFrame()

bool Dragengine.Scenery.DefaultECAttachableBehavior.requiresEnterFrame ( )

◆ requiresThink()

bool Dragengine.Scenery.DefaultECAttachableBehavior.requiresThink ( )

◆ safeDispose()

void Dragengine.Scenery.DefaultECAttachableBehavior.safeDispose ( )

Remove from element if present then call dispose().

Use this call to safely dispose of the attachable behavior.

◆ setElement()

void Dragengine.Scenery.DefaultECAttachableBehavior.setElement ( BehaviorElement  element)

◆ setRequiresEnterFrame()

void Dragengine.Scenery.DefaultECAttachableBehavior.setRequiresEnterFrame ( bool  required)
protected

Set if behavior instance requires enterFrame() to be called.

◆ setRequiresThink()

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

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

◆ stateChanged()

void Dragengine.Scenery.DefaultECAttachableBehavior.stateChanged ( )

◆ think()

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

◆ writeObjectToFile()

void Dragengine.Scenery.DefaultECAttachableBehavior.writeObjectToFile ( PersistencyEnvironment  env,
FileWriter  writer 
)

Member Data Documentation

◆ pElement

BehaviorElement Dragengine.Scenery.DefaultECAttachableBehavior.pElement

◆ pRequiresEnterFrame

bool Dragengine.Scenery.DefaultECAttachableBehavior.pRequiresEnterFrame

◆ pRequiresThink

bool Dragengine.Scenery.DefaultECAttachableBehavior.pRequiresThink

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