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

Behavior element element class. More...

Inheritance diagram for Dragengine.Scenery.BehaviorElementClass:
Dragengine.Scenery.ElementClass Dragengine.ResourceListener Dragengine.Gui.MainMenus.Interactive.IMMEnvironmentMapClass Dragengine.Gui.MainMenus.Interactive.IMMLightClass Dragengine.Gui.MainMenus.Interactive.IMMParticleEmitterClass Dragengine.Gui.MainMenus.Interactive.IMMPropClass Dragengine.Gui.MainMenus.Interactive.IMMSpeakerClass Dragengine.Scenery.AttachSlotClass Dragengine.Scenery.AttachableBaseBillboardClass Dragengine.Scenery.AttachableBaseForceFieldClass Dragengine.Scenery.AttachableBaseLightClass Dragengine.Scenery.AttachableBaseParticleEmitterClass Dragengine.Scenery.AttachableBaseSpeakerClass Dragengine.Scenery.BaseActorClass Dragengine.Scenery.BaseBillboardClass Dragengine.Scenery.BaseForceFieldClass Dragengine.Scenery.BaseLightClass Dragengine.Scenery.BaseParticleEmitterClass Dragengine.Scenery.BaseSkyClass Dragengine.Scenery.BaseSpeakerClass Dragengine.Scenery.BaseWorldClass Dragengine.Scenery.EnvironmentMapClass Dragengine.Scenery.GenericBehaviorElementClass Dragengine.Scenery.GhostElementClass Dragengine.Scenery.InfoConvoCoordSystemClass Dragengine.Scenery.PhysicsElementClass Dragengine.Scenery.SimpleElementClass Dragengine.Scenery.TriggerConversationClass Dragengine.Scenery.TriggerEvaluateClass Dragengine.Scenery.TriggerShoutClass Dragengine.Scenery.TriggerTimerClass Dragengine.Scenery.TriggerToggleClass Dragengine.Scenery.TriggerTouchClass Dragengine.TestSystem.TestCaseECBehavior.TestBehaviorElementClass Dragengine.TestSystem.TestCaseECBehaviorPersistency.TestBehaviorElementClass

Classes

class  XmlBehaviorInfo
 XML behavior information required for XML-XML subclassing. More...

Public Member Functions

void addAttachableBehaviorFactories ()
 Add attachable behavior factories supported by this element class.
void addAttachableBehaviorFactories (AttachableBehaviorFactoryList factories)
 Add attachable behavior factories replacing duplicates if present.
void addAttachableBehaviorFactory (AttachableBehaviorFactory factory)
 Add attachable behavior factory replacing duplicate if present.
void addBehavior (ECBehavior behavior)
 Add behavior.
void addBehaviorFactories (BehaviorFactoryList factories)
 Add behavior factories replacing duplicates if present.
void addDefaultAttachableBehaviorFactories ()
 Add all attachable behavior factories present in the DragonScript module.
void addDefaultBehaviorFactories ()
 Add all behavior factories present in the DragonScript module.
void addXmlBehaviorInfo (BehaviorFactory factory, String id, Dictionary parameters)
 Add XML behavior information required for XML-XML subclassing.
Array collectBehaviors (Block ablock)
 Collect behaviors with block into Array.
void createAndAddElement (StubElement stub, GameWorld gameWorld)
 Create element from given stub and add it to game world.
void dispose ()
 Dispose of element class.
ECBehavior findBehavior (Block ablock)
 Find behavior with block.
void forEachAttachableBehaviorFactory (Block ablock)
 Visit attachable behavior factories.
void forEachBehavior (Block ablock)
 Visit behaviors with block.
void forEachBehaviorDirect (Block ablock)
 Visit behaviors with block.
void forEachBehaviorFactory (Block ablock)
 Visit behavior factories.
void forEachPrepareStubBehavior (Block ablock)
 Visit prepare stub behaviors with block. version 1.23.
void forEachPreventCreationBehavior (Block ablock)
 Visit prevent creation behaviors with block. version 1.23.
void forEachXmlBehaviorInfo (Block ablock)
 Visit XML behavior info with block with argument XmlBehaviorInfo.
AttachableBehaviorFactory getAttachableBehaviorFactoryWithId (String id)
 Attachable behavior factory with identifier or null if absent.
ECBehavior getBehaviorAt (int index)
 Behavior at index.
BehaviorFactory getBehaviorFactoryWithId (String id)
 Behavior factory with identifier or null if absent.
ECBehavior getBehaviorWithId (String id)
 Behavior with matching BehaviorCompatiblePersistency.getBehaviorID() or null.
BehaviorElementClass new ()
 Create element class using loaders from BaseGameApp.
BehaviorElementClass new (Loaders loaders)
 Create element class.
BehaviorElementClass new (String className)
 Create element class using loaders from BaseGameApp.
BehaviorElementClass new (String className, Loaders loaders)
 Create element class.
void prepareStubs (StubElement stub, GameWorld gameWorld, bool loading)
 Call prepareStub on all prepare stub behaviors.
bool preventCreation (StubElement stub, GameWorld gameWorld)
 Call prepareStub on all prepare stub behaviors.
void removeAllAttachableBehaviorFactories ()
 Remove all attachable behavior factories.
void removeAllBehaviorFactories ()
 Remove all behavior factories.
Public Member Functions inherited from Dragengine.Scenery.ElementClass
void addProperty (ElementClassProperty property)
 Add property.
void copyPropertyValues (ElementClass eclass)
 Copy values of properties from another class to properties of this class.
Element createElement (StubElement stub)
 Create element instance from stub.
ElementClass duplicateNamed (String classname)
 Create duplicate of class with new name.
bool equals (Object obj)
 Element class is equal to another object.
void failedLoading (String path, ResourceLoaderType resourceType)
 Resource failed loading.
void finishedLoading (String path, ResourceLoaderType resourceType, Object resource)
 Resource finished loading successfully.
void forEachProperty (Block ablock)
 Visit properties with block with parameter ElementClass.
String getBasePath ()
 Base path for relative loading of resource properties.
CodecPropertyString getCodecPropertyString ()
 Property codec helper.
bool getIsXmlElementClass ()
 Element class is an XML element class.
bool getPersistable ()
 Element class is persistable to file writers.
int getPropertyCount ()
 Number of properties.
ElementClassProperty getPropertyNamed (String name)
 Named property or null if absent.
Array getPropertyNames ()
 List of property names as array of strings.
TSTriggerExpressionParser getTriggerExpressionParser ()
 Trigger expression parser.
int hashCode ()
 Hash code.
bool hasPropertyNamed (String name)
 Named property is present.
Object injectProperty (Object injectValue, Block ablock)
 Process value visiting properties.
void loadAndAddElement (PersistencyEnvironment env, StubElement stub, FileReader reader, GameWorld gameWorld)
 Load element from file reader and add it to game world.
Element loadElement (PersistencyEnvironment env, StubElement stub, FileReader reader)
 Load element from file reader.
void removeAllProperties ()
 Remove all properties.
void removeProperty (ElementClassProperty property)
 Remove property.
void setBasePath (String path)
 Set base path for relative loading of resource properties.
void setIsXmlElementClass (bool isXmlElementClass)
 Set if element class is an XML element class.
void setPersistable (bool persistable)
 Set element class is persistable to file writers.
void setPropertyValue (String name, Object value)
 Set value of named property.
Public Member Functions inherited from Dragengine.ResourceListener

Public Attributes

Dictionary pBehaviorFactories
Dictionary pBehaviorIdMap
Array pBehaviors
Array pXmlBehaviorsInfo

Static Public Attributes

static BehaviorFactoryHelper sharedFactoryHelper = BehaviorFactoryHelper.new()

Protected Member Functions

Element createElement ()
 Create element instance.

Additional Inherited Members

Static Public Member Functions inherited from Dragengine.Scenery.ElementClass
static CodecPropertyString getSharedCodecPropertyString ()
 Shared property codec helper.
static TSTriggerExpressionParser getSharedTriggerExpressionParser ()
 Shared trigger expression parser.
static void setSharedCodecPropertyString (CodecPropertyString codec)
 Set shared property codec helper.
static void setSharedTriggerExpressionParser (TSTriggerExpressionParser parser)
 Set shared trigger expression parser.

Detailed Description

Behavior element element class.

Behavior elements are jack of all trade elements. They allow building complex element behaviors by using behavior building blocks. These behavior building blocks are provided by ECBehavior classes attached to the element class.

Behavior elements are suited for prototyping and rapid development since they require little written code. For highly optimized elements building them using the conventional way might be a better option. For all other uses behavior elements are fast and reusable.

To create an element based on BehaviorElement create a new subclass of BehaviorElementClass and add all the desired ECBehavior instance. There is no need to subclas BehaviorElement. When creating a new instance the BehaviorElement is filled with ECBehavior created ECBehaviorInstance instances. These provide the actual behavior to the element.

Behaviors can also be created and added using XML element classes. Add the factories of all behavior types allowed to be created using #addBehaviorFactory(). By default no factory is present disabling support for XML behavior creation.

Member Function Documentation

◆ addAttachableBehaviorFactories() [1/2]

void Dragengine.Scenery.BehaviorElementClass.addAttachableBehaviorFactories ( )

Add attachable behavior factories supported by this element class.

Version
1.29

Default implementation calls addDefaultAttachableBehaviorFactories().

References new().

◆ addAttachableBehaviorFactories() [2/2]

void Dragengine.Scenery.BehaviorElementClass.addAttachableBehaviorFactories ( AttachableBehaviorFactoryList factories)

Add attachable behavior factories replacing duplicates if present.

Version
1.29

Referenced by addBehavior(), and createAndAddElement().

◆ addAttachableBehaviorFactory()

void Dragengine.Scenery.BehaviorElementClass.addAttachableBehaviorFactory ( AttachableBehaviorFactory factory)

Add attachable behavior factory replacing duplicate if present.

Version
1.29

References forEachPrepareStubBehavior().

Referenced by createAndAddElement().

◆ addBehavior()

void Dragengine.Scenery.BehaviorElementClass.addBehavior ( ECBehavior behavior)

Add behavior.

This is called by constructors of class implementing ECBehavior. Usually you do not have to call this manually.

References addAttachableBehaviorFactories(), dispose(), pBehaviorIdMap, and pBehaviors.

Referenced by forEachBehaviorDirect().

◆ addBehaviorFactories()

void Dragengine.Scenery.BehaviorElementClass.addBehaviorFactories ( BehaviorFactoryList factories)

Add behavior factories replacing duplicates if present.

Version
1.25

References pBehaviors.

Referenced by createAndAddElement().

◆ addDefaultAttachableBehaviorFactories()

void Dragengine.Scenery.BehaviorElementClass.addDefaultAttachableBehaviorFactories ( )

Add all attachable behavior factories present in the DragonScript module.

Version
1.29

Add BaseGameApp.getAttachableBehaviorFactories().

Referenced by createAndAddElement().

◆ addDefaultBehaviorFactories()

void Dragengine.Scenery.BehaviorElementClass.addDefaultBehaviorFactories ( )

◆ addXmlBehaviorInfo()

void Dragengine.Scenery.BehaviorElementClass.addXmlBehaviorInfo ( BehaviorFactory factory,
String id,
Dictionary parameters )

Add XML behavior information required for XML-XML subclassing.

Version
1.25

References new().

Referenced by createAndAddElement().

◆ collectBehaviors()

Array Dragengine.Scenery.BehaviorElementClass.collectBehaviors ( Block ablock)

Collect behaviors with block into Array.

Version
1.5

Block is required to have one parameter ECBehavior or subclass thereof and returning true if the right behavior is found otherwise false. Block is called only for behaviors castable to block parameter type.

References getBehaviorAt(), and pBehaviors.

Referenced by forEachPreventCreationBehavior().

◆ createAndAddElement()

void Dragengine.Scenery.BehaviorElementClass.createAndAddElement ( StubElement stub,
GameWorld gameWorld )

◆ createElement()

Element Dragengine.Scenery.BehaviorElementClass.createElement ( )
protected

Create element instance.

Reimplemented from Dragengine.Scenery.ElementClass.

Reimplemented in Dragengine.Gui.MainMenus.Interactive.IMMEnvironmentMapClass, Dragengine.Gui.MainMenus.Interactive.IMMHotSpotClass, Dragengine.Gui.MainMenus.Interactive.IMMLightClass, Dragengine.Gui.MainMenus.Interactive.IMMParticleEmitterClass, Dragengine.Gui.MainMenus.Interactive.IMMPropClass, Dragengine.Gui.MainMenus.Interactive.IMMSpeakerClass, Dragengine.Scenery.AnimatedElementClass, Dragengine.Scenery.AttachableBaseBillboardClass, Dragengine.Scenery.AttachableBaseForceFieldClass, Dragengine.Scenery.AttachableBaseLightClass, Dragengine.Scenery.AttachableBaseParticleEmitterClass, Dragengine.Scenery.AttachableBaseSpeakerClass, Dragengine.Scenery.AttachSlotClass, Dragengine.Scenery.BaseActorClass, Dragengine.Scenery.BaseBillboardClass, Dragengine.Scenery.BaseForceFieldClass, Dragengine.Scenery.BaseLightClass, Dragengine.Scenery.BaseParticleEmitterClass, Dragengine.Scenery.BaseSkyClass, Dragengine.Scenery.BaseSpeakerClass, Dragengine.Scenery.BaseVRActorClass, Dragengine.Scenery.BaseWorldClass, Dragengine.Scenery.EnvironmentMapClass, Dragengine.Scenery.GhostElementClass, Dragengine.Scenery.HiddenElementClass, Dragengine.Scenery.InfoConvoCoordSystemClass, Dragengine.Scenery.PhysicsElementClass, Dragengine.Scenery.SimpleElementClass, Dragengine.Scenery.SimpleElementOnRailClass, Dragengine.Scenery.TriggerConversationClass, Dragengine.Scenery.TriggerEvaluateClass, Dragengine.Scenery.TriggerShoutClass, Dragengine.Scenery.TriggerTimerClass, Dragengine.Scenery.TriggerToggleClass, Dragengine.Scenery.TriggerTouchClass, Dragengine.Scenery.TwoStateAnimatedElementClass, Dragengine.TestSystem.TestCaseECBehavior.TestBehaviorElementClass, and Dragengine.TestSystem.TestCaseECBehaviorPersistency.TestBehaviorElementClass.

References forEachPreventCreationBehavior().

Referenced by createAndAddElement().

◆ dispose()

void Dragengine.Scenery.BehaviorElementClass.dispose ( )

◆ findBehavior()

ECBehavior Dragengine.Scenery.BehaviorElementClass.findBehavior ( Block ablock)

Find behavior with block.

Block is required to have one parameter ECBehavior or subclass thereof and returning true if the right behavior is found otherwise false. Block is called only for behaviors castable to block parameter type.

References dispose(), and pBehaviors.

Referenced by prepareStubs().

◆ forEachAttachableBehaviorFactory()

void Dragengine.Scenery.BehaviorElementClass.forEachAttachableBehaviorFactory ( Block ablock)

Visit attachable behavior factories.

Version
1.29

Block receives as only argument AttachableBehaviorFactory.

Referenced by createAndAddElement().

◆ forEachBehavior()

void Dragengine.Scenery.BehaviorElementClass.forEachBehavior ( Block ablock)

Visit behaviors with block.

Block is required to have one parameter of type ECBehavior or subclass thereof. Block is called only for behaviors castable to block parameter type.

References pBehaviorFactories, and pBehaviors.

Referenced by forEachPrepareStubBehavior().

◆ forEachBehaviorDirect()

void Dragengine.Scenery.BehaviorElementClass.forEachBehaviorDirect ( Block ablock)

Visit behaviors with block.

Block is required to have one parameter of type ECBehavior. For use by BehaviorElement.

References addBehavior(), and pBehaviors.

Referenced by preventCreation().

◆ forEachBehaviorFactory()

void Dragengine.Scenery.BehaviorElementClass.forEachBehaviorFactory ( Block ablock)

Visit behavior factories.

Version
1.25

Block receives as only argument BehaviorFactory.

Referenced by createAndAddElement().

◆ forEachPrepareStubBehavior()

void Dragengine.Scenery.BehaviorElementClass.forEachPrepareStubBehavior ( Block ablock)

Visit prepare stub behaviors with block. version 1.23.

Block is required to have one parameter of type ECBehavior or subclass thereof. Block is called only for behaviors castable to block parameter type.

References forEachBehavior(), and pBehaviors.

Referenced by addAttachableBehaviorFactory().

◆ forEachPreventCreationBehavior()

void Dragengine.Scenery.BehaviorElementClass.forEachPreventCreationBehavior ( Block ablock)

Visit prevent creation behaviors with block. version 1.23.

Block is required to have one parameter of type ECBehavior or subclass thereof. Block is called only for behaviors castable to block parameter type.

References collectBehaviors(), and pBehaviors.

Referenced by createElement().

◆ forEachXmlBehaviorInfo()

void Dragengine.Scenery.BehaviorElementClass.forEachXmlBehaviorInfo ( Block ablock)

Visit XML behavior info with block with argument XmlBehaviorInfo.

Version
1.25

Referenced by createAndAddElement().

◆ getAttachableBehaviorFactoryWithId()

AttachableBehaviorFactory Dragengine.Scenery.BehaviorElementClass.getAttachableBehaviorFactoryWithId ( String id)

Attachable behavior factory with identifier or null if absent.

Version
1.29

Referenced by createAndAddElement().

◆ getBehaviorAt()

ECBehavior Dragengine.Scenery.BehaviorElementClass.getBehaviorAt ( int index)

Behavior at index.

References new(), pBehaviorFactories, pBehaviors, and pXmlBehaviorsInfo.

Referenced by collectBehaviors().

◆ getBehaviorFactoryWithId()

BehaviorFactory Dragengine.Scenery.BehaviorElementClass.getBehaviorFactoryWithId ( String id)

Behavior factory with identifier or null if absent.

Version
1.25

Referenced by createAndAddElement().

◆ getBehaviorWithId()

ECBehavior Dragengine.Scenery.BehaviorElementClass.getBehaviorWithId ( String id)

Behavior with matching BehaviorCompatiblePersistency.getBehaviorID() or null.

Version
1.26

For use with persistency compatible behaviors.

References new(), and pBehaviors.

Referenced by removeAllBehaviorFactories().

◆ new() [1/4]

◆ new() [2/4]

BehaviorElementClass Dragengine.Scenery.BehaviorElementClass.new ( Loaders loaders)

◆ new() [3/4]

◆ new() [4/4]

BehaviorElementClass Dragengine.Scenery.BehaviorElementClass.new ( String className,
Loaders loaders )

◆ prepareStubs()

void Dragengine.Scenery.BehaviorElementClass.prepareStubs ( StubElement stub,
GameWorld gameWorld,
bool loading )

Call prepareStub on all prepare stub behaviors.

Version
1.23

For use by subclasses overwriting createAndAddElement(StubElement,GameWorld) or loadAndAddElement(PersistencyEnvironment,StubElement,FileReader,GameWorld) without super calling.

See also
BehaviorPrepareStub.prepareStub(StubElement,GameWorld,bool)

References findBehavior(), and pBehaviors.

Referenced by removeAllAttachableBehaviorFactories().

◆ preventCreation()

bool Dragengine.Scenery.BehaviorElementClass.preventCreation ( StubElement stub,
GameWorld gameWorld )

Call prepareStub on all prepare stub behaviors.

Version
1.23

For use by subclasses overwriting createAndAddElement(StubElement,GameWorld) without super calling.

See also
BehaviorPreventCreation.preventCreation(StubElement,GameWorld)

References forEachBehaviorDirect().

Referenced by createAndAddElement().

◆ removeAllAttachableBehaviorFactories()

void Dragengine.Scenery.BehaviorElementClass.removeAllAttachableBehaviorFactories ( )

Remove all attachable behavior factories.

Version
1.29

References prepareStubs().

Referenced by createAndAddElement().

◆ removeAllBehaviorFactories()

void Dragengine.Scenery.BehaviorElementClass.removeAllBehaviorFactories ( )

Remove all behavior factories.

Version
1.25

References getBehaviorWithId(), new(), pBehaviorIdMap, and pBehaviors.

Referenced by createAndAddElement().

Member Data Documentation

◆ pBehaviorFactories

Dictionary Dragengine.Scenery.BehaviorElementClass.pBehaviorFactories

◆ pBehaviorIdMap

Dictionary Dragengine.Scenery.BehaviorElementClass.pBehaviorIdMap

◆ pBehaviors

◆ pXmlBehaviorsInfo

Array Dragengine.Scenery.BehaviorElementClass.pXmlBehaviorsInfo

◆ sharedFactoryHelper

BehaviorFactoryHelper Dragengine.Scenery.BehaviorElementClass.sharedFactoryHelper = BehaviorFactoryHelper.new()
static

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