Drag[en]gine Script Module DragonScript
1.21
|
Behavior element element class. More...
Public Member Functions | |
void | addBehavior (ECBehavior behavior) |
Add behavior. More... | |
void | addPrepareStubBehavior (BehaviorPrepareStub behavior) |
Add behavior to be notified before initialization is done. More... | |
Array | collectBehaviors (Block ablock) |
Collect behaviors with block into Array. More... | |
void | createAndAddElement (StubElement stub, GameWorld gameWorld) |
Create element from given stub and add it to game world. More... | |
void | dispose () |
Dispose of element class. More... | |
ECBehavior | findBehavior (Block ablock) |
Find behavior with block. More... | |
void | forEachBehavior (Block ablock) |
Visit behaviors with block. More... | |
void | forEachBehaviorDirect (Block ablock) |
Visit behaviors with block. More... | |
ECBehavior | getBehaviorAt (int index) |
Behavior at index. More... | |
BehaviorElementClass | new () |
Create element class using loaders from BaseGameApp. More... | |
BehaviorElementClass | new (Loaders loaders) |
Create element class. More... | |
BehaviorElementClass | new (String className) |
Create element class using loaders from BaseGameApp. More... | |
BehaviorElementClass | new (String className, Loaders loaders) |
Create element class. More... | |
Public Member Functions inherited from Dragengine.Scenery.ElementClass | |
void | addProperty (ElementClassProperty property) |
Add property. More... | |
void | copyPropertyValues (ElementClass eclass) |
Copy values of properties from another class to properties of this class. More... | |
Element | createElement (StubElement stub) |
Create element instance from stub. More... | |
ElementClass | duplicateNamed (String classname) |
Create duplicate of class with new name. More... | |
bool | equals (Object obj) |
Element class is equal to another object. More... | |
void | failedLoading (String path, ResourceLoaderType resourceType) |
Resource failed loading. More... | |
void | finishedLoading (String path, ResourceLoaderType resourceType, Object resource) |
Resource finished loading successfully. More... | |
void | forEachProperty (Block ablock) |
Visit properties with block with parameter ElementClass. More... | |
String | getBasePath () |
Base path for relative loading of resource properties. More... | |
CodecPropertyString | getCodecPropertyString () |
Property codec helper. More... | |
bool | getIsXmlElementClass () |
Element class is an XML element class. More... | |
bool | getPersistable () |
Element class is persistable to file writers. More... | |
int | getPropertyCount () |
Number of properties. More... | |
ElementClassProperty | getPropertyNamed (String name) |
Named property or null if absent. More... | |
Array | getPropertyNames () |
List of property names as array of strings. More... | |
TSTriggerExpressionParser | getTriggerExpressionParser () |
Trigger expression parser. More... | |
int | hashCode () |
Hash code. More... | |
bool | hasPropertyNamed (String name) |
Named property is present. More... | |
Object | injectProperty (Object injectValue, Block ablock) |
Process value visiting properties. More... | |
void | loadAndAddElement (PersistencyEnvironment env, StubElement stub, FileReader reader, GameWorld gameWorld) |
Load element from file reader and add it to game world. More... | |
Element | loadElement (PersistencyEnvironment env, StubElement stub, FileReader reader) |
Load element from file reader. More... | |
void | removeAllProperties () |
Remove all properties. More... | |
void | removeProperty (ElementClassProperty property) |
Remove property. More... | |
void | setBasePath (String path) |
Set base path for relative loading of resource properties. More... | |
void | setIsXmlElementClass (bool isXmlElementClass) |
Set if element class is an XML element class. More... | |
void | setPersistable (bool persistable) |
Set element class is persistable to file writers. More... | |
void | setPropertyValue (String name, Object value) |
Set value of named property. More... | |
Notification |
Protected Member Functions | |
Element | createElement () |
Create element instance. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from Dragengine.Scenery.ElementClass | |
static CodecPropertyString | getSharedCodecPropertyString () |
Shared property codec helper. More... | |
static TSTriggerExpressionParser | getSharedTriggerExpressionParser () |
Shared trigger expression parser. More... | |
static void | setSharedCodecPropertyString (CodecPropertyString codec) |
Set shared property codec helper. More... | |
static void | setSharedTriggerExpressionParser (TSTriggerExpressionParser parser) |
Set shared trigger expression parser. More... | |
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.
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.
void Dragengine.Scenery.BehaviorElementClass.addPrepareStubBehavior | ( | BehaviorPrepareStub | behavior | ) |
Add behavior to be notified before initialization is done.
Preinitializing allows behaviors to modify StubElement before Element.init() is called. This can be used to alter the behavior initialization procss my modifying the stub properties or textures.
This function is only called for newly created elements. For loading elements preinitializing is not done since the preinitialized state has been already saved.
Usually preinitializing is done for elements to be added to a game world. It is thus possible to use game world stub properties to alter the initialization. This can be used to adjust the behavior depending on what game world they are created for. It is also possible preinitialization is done without the element to be added to a specific game world. In this case gameWorld is null. Behaviors added for preinitializing have to be able to handle gameWorld being null.
Array Dragengine.Scenery.BehaviorElementClass.collectBehaviors | ( | Block | ablock | ) |
Collect behaviors with block into Array.
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.
void Dragengine.Scenery.BehaviorElementClass.createAndAddElement | ( | StubElement | stub, |
GameWorld | gameWorld | ||
) |
Create element from given stub and add it to game world.
Calls prepareStub() on behaviors supporting stub preparation. Then calls createElement(stub) 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.
|
protected |
Create element instance.
Reimplemented from Dragengine.Scenery.ElementClass.
Reimplemented in Dragengine.TestSystem.TestCaseECBehaviorPersistency.TestBehaviorElementClass, Dragengine.TestSystem.TestCaseECBehavior.TestBehaviorElementClass, Dragengine.Scenery.TwoStateAnimatedElementClass, Dragengine.Scenery.TriggerTouchClass, Dragengine.Scenery.TriggerToggleClass, Dragengine.Scenery.TriggerTimerClass, Dragengine.Scenery.TriggerShoutClass, Dragengine.Scenery.TriggerEvaluateClass, Dragengine.Scenery.TriggerConversationClass, Dragengine.Scenery.SimpleElementClass, Dragengine.Scenery.SimpleElementOnRailClass, Dragengine.Scenery.PhysicsElementClass, Dragengine.Scenery.InfoConvoCoordSystemClass, Dragengine.Scenery.HiddenElementClass, Dragengine.Scenery.GhostElementClass, Dragengine.Scenery.EnvironmentMapClass, Dragengine.Scenery.BaseSpeakerClass, Dragengine.Scenery.BaseSkyClass, Dragengine.Scenery.BaseParticleEmitterClass, Dragengine.Scenery.BaseLightClass, Dragengine.Scenery.BaseForceFieldClass, Dragengine.Scenery.BaseBillboardClass, Dragengine.Scenery.AttachSlotClass, Dragengine.Scenery.AttachableBaseSpeakerClass, Dragengine.Scenery.AttachableBaseParticleEmitterClass, Dragengine.Scenery.AttachableBaseLightClass, Dragengine.Scenery.AttachableBaseForceFieldClass, Dragengine.Scenery.AttachableBaseBillboardClass, Dragengine.Scenery.AnimatedElementClass, Dragengine.Scenery.BaseVRActorClass, Dragengine.Scenery.BaseActorClass, Dragengine.Gui.MainMenus.Interactive.IMMSpeakerClass, Dragengine.Gui.MainMenus.Interactive.IMMPropClass, Dragengine.Gui.MainMenus.Interactive.IMMParticleEmitterClass, Dragengine.Gui.MainMenus.Interactive.IMMLightClass, Dragengine.Gui.MainMenus.Interactive.IMMHotSpotClass, and Dragengine.Gui.MainMenus.Interactive.IMMEnvironmentMapClass.
void Dragengine.Scenery.BehaviorElementClass.dispose | ( | ) |
Dispose of element class.
Reimplemented from Dragengine.Scenery.ElementClass.
Reimplemented in Dragengine.TestSystem.TestCaseECBehaviorPersistency.TestBehaviorElementClass, and Dragengine.TestSystem.TestCaseECBehavior.TestBehaviorElementClass.
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.
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.
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.
ECBehavior Dragengine.Scenery.BehaviorElementClass.getBehaviorAt | ( | int | index | ) |
Behavior at index.
BehaviorElementClass Dragengine.Scenery.BehaviorElementClass.new | ( | ) |
Create element class using loaders from BaseGameApp.
Reimplemented in Dragengine.Scenery.TwoStateAnimatedElementClass, Dragengine.Scenery.SimpleElementClass, Dragengine.Scenery.SimpleElementOnRailClass, Dragengine.Scenery.PhysicsElementClass, Dragengine.Scenery.InfoConvoCoordSystemClass, Dragengine.Scenery.HiddenElementClass, Dragengine.Scenery.GhostElementClass, Dragengine.Scenery.EnvironmentMapClass, Dragengine.Scenery.BaseSpeakerClass, Dragengine.Scenery.BaseSkyClass, Dragengine.Scenery.BaseParticleEmitterClass, Dragengine.Scenery.BaseLightClass, Dragengine.Scenery.BaseForceFieldClass, Dragengine.Scenery.BaseBillboardClass, Dragengine.Scenery.AttachSlotClass, Dragengine.Scenery.AttachableBaseSpeakerClass, Dragengine.Scenery.AttachableBaseParticleEmitterClass, Dragengine.Scenery.AttachableBaseLightClass, Dragengine.Scenery.AttachableBaseForceFieldClass, Dragengine.Scenery.AttachableBaseBillboardClass, Dragengine.Scenery.AnimatedElementClass, Dragengine.Scenery.BaseVRActorClass, and Dragengine.Scenery.BaseActorClass.
BehaviorElementClass Dragengine.Scenery.BehaviorElementClass.new | ( | Loaders | loaders | ) |
Create element class.
Reimplemented in Dragengine.Scenery.SimpleElementClass, Dragengine.Scenery.GhostElementClass, and Dragengine.Scenery.BaseSkyClass.
BehaviorElementClass Dragengine.Scenery.BehaviorElementClass.new | ( | String | className | ) |
Create element class using loaders from BaseGameApp.
Reimplemented from Dragengine.Scenery.ElementClass.
Reimplemented in Dragengine.Scenery.InfoConvoCoordSystemClass, Dragengine.Scenery.EnvironmentMapClass, Dragengine.Scenery.TwoStateAnimatedElementClass, Dragengine.Scenery.SimpleElementClass, Dragengine.Scenery.SimpleElementOnRailClass, Dragengine.Scenery.PhysicsElementClass, Dragengine.Scenery.HiddenElementClass, Dragengine.Scenery.GhostElementClass, Dragengine.Scenery.BaseSpeakerClass, Dragengine.Scenery.BaseSkyClass, Dragengine.Scenery.BaseParticleEmitterClass, Dragengine.Scenery.BaseLightClass, Dragengine.Scenery.BaseForceFieldClass, Dragengine.Scenery.BaseBillboardClass, Dragengine.Scenery.AttachSlotClass, Dragengine.Scenery.AttachableBaseSpeakerClass, Dragengine.Scenery.AttachableBaseParticleEmitterClass, Dragengine.Scenery.AttachableBaseLightClass, Dragengine.Scenery.AttachableBaseForceFieldClass, Dragengine.Scenery.AttachableBaseBillboardClass, Dragengine.Scenery.AnimatedElementClass, Dragengine.Scenery.BaseVRActorClass, and Dragengine.Scenery.BaseActorClass.
BehaviorElementClass Dragengine.Scenery.BehaviorElementClass.new | ( | String | className, |
Loaders | loaders | ||
) |
Create element class.
Reimplemented in Dragengine.Scenery.SimpleElementClass, Dragengine.Scenery.GhostElementClass, and Dragengine.Scenery.BaseSkyClass.