Drag[en]gine Script Module DragonScript 1.32.1
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.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

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

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().

◆ addAttachableBehaviorFactories() [2/2]

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

Add attachable behavior factories replacing duplicates if present.

Version
1.29

◆ addAttachableBehaviorFactory()

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

Add attachable behavior factory replacing duplicate if present.

Version
1.29

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

◆ addBehaviorFactories()

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

Add behavior factories replacing duplicates if present.

Version
1.25

◆ addDefaultAttachableBehaviorFactories()

void Dragengine.Scenery.BehaviorElementClass.addDefaultAttachableBehaviorFactories ( )

Add all attachable behavior factories present in the DragonScript module.

Version
1.29

Add BaseGameApp::getAttachableBehaviorFactories().

◆ addDefaultBehaviorFactories()

void Dragengine.Scenery.BehaviorElementClass.addDefaultBehaviorFactories ( )

Add all behavior factories present in the DragonScript module.

Version
1.25

Add BaseGameApp::getBehaviorFactories().

◆ addXmlBehaviorInfo()

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

Add XML behavior information required for XML-XML subclassing.

Version
1.25

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

◆ createAndAddElement()

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

Create element from given stub and add it to game world.

Calls BehaviorPrepareStub::prepareStub(StubElement,GameWorld,bool) on behaviors supporting stub preparation. Then calls BehaviorPreventCreation::preventCreation(StubElement,GameWorld) to check if creating and adding the element has to be cancelled. Then calls #createElement(StubElement) to obtain new element instance. If returned element is null no further processing is done. Otherwise element is added to gameWorld.

Reimplemented from Dragengine.Scenery.ElementClass.

◆ createElement()

◆ dispose()

void Dragengine.Scenery.BehaviorElementClass.dispose ( )

Dispose of element class.

Reimplemented from Dragengine.Scenery.ElementClass.

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

◆ forEachAttachableBehaviorFactory()

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

Visit attachable behavior factories.

Version
1.29

Block receives as only argument AttachableBehaviorFactory.

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

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

◆ forEachBehaviorFactory()

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

Visit behavior factories.

Version
1.25

Block receives as only argument BehaviorFactory.

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

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

◆ forEachXmlBehaviorInfo()

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

Visit XML behavior info with block with argument XmlBehaviorInfo.

Version
1.25

◆ getAttachableBehaviorFactoryWithId()

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

Attachable behavior factory with identifier or null if absent.

Version
1.29

◆ getBehaviorAt()

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

Behavior at index.

◆ getBehaviorFactoryWithId()

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

Behavior factory with identifier or null if absent.

Version
1.25

◆ getBehaviorWithId()

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

Behavior with matching BehaviorCompatiblePersistency::getBehaviorID() or null.

Version
1.26

For use with persistency compatible behaviors.

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

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

◆ removeAllAttachableBehaviorFactories()

void Dragengine.Scenery.BehaviorElementClass.removeAllAttachableBehaviorFactories ( )

Remove all attachable behavior factories.

Version
1.29

◆ removeAllBehaviorFactories()

void Dragengine.Scenery.BehaviorElementClass.removeAllBehaviorFactories ( )

Remove all behavior factories.

Version
1.25

Member Data Documentation

◆ pBehaviorFactories

Dictionary Dragengine.Scenery.BehaviorElementClass.pBehaviorFactories

◆ pBehaviorIdMap

Dictionary Dragengine.Scenery.BehaviorElementClass.pBehaviorIdMap

◆ pBehaviors

Array Dragengine.Scenery.BehaviorElementClass.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: