Drag[en]gine Script Module DragonScript
1.21
|
Behavior element behavior adding force field support. More...
Classes | |
class | BlockListenerFactory |
Factory creating listeners using block. More... | |
class | DefaultListener |
Default implementation of behavior instance listener. More... | |
class | Instance |
Behavior instance. More... | |
interface | Listener |
Listener for behavior instance events. More... | |
interface | ListenerFactory |
Factory creating listeners. More... | |
Public Member Functions | |
void | addListenerFactory (Block blockFactory) |
Add listener factory using block. More... | |
void | addListenerFactory (ListenerFactory factory) |
Add listener factory. More... | |
ECBehaviorInstance | createInstance (BehaviorElement element) |
Create Behavior instance. More... | |
void | dispose () |
Dispose of behavior. More... | |
void | forEachListenerFactory (Block ablock) |
Visit listener factories with block with argument ListenerFactory. More... | |
ECComposeAttachResource | getAttach () |
Attach resource. More... | |
ECBehaviorCollider | getCollider () |
Collider behavior or null to not attach. More... | |
ECComposeForceField | getForceField () |
Composeable force field for element class. More... | |
ECBehaviorForceField | getSyncTrigger () |
ECBehaviorForceField to synchronize triggers with or null to disable. More... | |
ECBehaviorTriggered | getTrigger () |
Trigger enable. More... | |
TSTriggerTable | getTriggerTable () |
Trigger table or null if not used. More... | |
Instance | instance (BehaviorElement element) |
Get instance in element from owner element class. More... | |
ECBehaviorForceField | new (BehaviorElementClass eclass, ECBehaviorCollider collider) |
Create behavior element class. More... | |
ECBehaviorForceField | new (BehaviorElementClass eclass, ECBehaviorCollider collider, String id) |
ECBehaviorForceField | new (BehaviorElementClass eclass, ECBehaviorCollider collider, TSTriggerTable triggerTable) |
ECBehaviorForceField | new (BehaviorElementClass eclass, ECBehaviorCollider collider, TSTriggerTable triggerTable, String id) |
ECBehaviorForceField | new (BehaviorElementClass eclass, ECBehaviorCollider collider, TSTriggerTable triggerTable, String id, String subID) |
ECBehaviorForceField | new (BehaviorElementClass eclass, ECBehaviorCollider collider, TSTriggerTable triggerTable, String id, String subID, String prefix) |
void | setSyncTrigger (ECBehaviorForceField behavior) |
ECBehaviorForceField to synchronize triggers with or null to disable. More... | |
Public Member Functions inherited from Dragengine.Scenery.DefaultECBehavior | |
void | assignInstanceIndex (int instanceIndex) |
Assign instance index. More... | |
String | getBehaviorID () |
Unique identifier of behavior. More... | |
String | getID () |
Identifier. More... | |
int | getInstanceIndex () |
Instance index. More... | |
void | loadSupportedData (String identifier, PersistencyEnvironment env, FileReader reader, ECBehaviorInstance instance) |
Load instance data of another behavior. More... | |
bool | supportsBehaviorID (String identifier) |
Behavior supports loading instance data of another behavior. More... | |
Static Public Member Functions | |
static Array | getAllBehaviorsIn (BehaviorElementClass eclass) |
Get list of all behaviors in element. More... | |
static Array | getAllInstancesIn (BehaviorElement element) |
Get list of all instances in element. More... | |
static ECBehaviorForceField | getBehaviorIn (BehaviorElementClass eclass) |
Get behavior in element class or null if absent. More... | |
static ECBehaviorForceField | getBehaviorIn (BehaviorElementClass eclass, String id) |
Get behavior with id in element class or null if absent. More... | |
static Instance | getInstanceIn (BehaviorElement element) |
Get instance in element or null if absent. More... | |
static Instance | getInstanceIn (BehaviorElement element, String id) |
Get instance with id in element or null if absent. More... | |
Protected Member Functions | |
void | setTriggerTable (TSTriggerTable triggerTable) |
Set trigger table or null if not used. More... | |
Protected Member Functions inherited from Dragengine.Scenery.DefaultECBehavior | |
DefaultECBehavior | new (BehaviorElementClass eclass) |
Create default composeable behavior with empty identifier. More... | |
DefaultECBehavior | new (BehaviorElementClass eclass, String id) |
Create default composeable behavior. More... | |
void | setBehaviorID (String identifier) |
Set behavior identifier. More... | |
void | useClassNameAsBehaviorID () |
Set behavior identifier to "<class-name>:<identifier>". More... | |
void | useFullyQualifiedClassNameAsBehaviorID () |
Set behavior identifier to "<fully-qualified-class-name>:<identifier>". More... | |
Behavior element behavior adding force field support.
Behavior adds a ForceField resource to the the behavior element. This behavior can be added multiple times to an element. Each instance creates one force field attached to the element collider which can be individually modified. To distinguish the force fields each instance has an identifier which can be used to retrieve a specific instance. The prefix of the force field class properties is "forceField." . If the identifier is not empty the force field element class properties have the prefix "{id}.forceField.". This can be overwritten if required. Hence to use more than one force field use code like this in your subclass constructor:
You can now define the parameters to use for both force fields using for example the properties "color" for the first force field and "subForceField.color" for the second forceField.
It is recommended to always specify an identifier even if only one force field is used. This avoids potentially name conflicts especially if other behaviors are added attaching other resources too.
If the ECBehaviorCollider behavior is present in the behavior element before this behavior is added the force field is attached. The force field is attached to the named bone if defined otherwise it is attached statically.
Element class properties have the prefix "forceField{(id)}.".
The owner element class and other behaviors can register a listener to be notified if the force field is (de)enabled. This can be used to provide customized force field handling support for example flickering or dimmable force fields.
If another behaviors wants to control the force field parameters in response to these events it should call setCustomForceFieldHandling(true). In this case the behavior implementing the force field parameter handling has to use requiresThink() to think while the effect lasts.
The enabled state of the force field is linked with the visibility state of the owner element. If the owner element becomes invisible the force field resource is always disabled. If the owner element becomes visible the force field resource is enabled if the behavior is enabled too.
If custom force field handling is used the behavior resposible for the custom force field handling is required to listen to stateChanged() calls and act accordingly. The force field resource will be always enabled no matter if the custom force field handling is enabled or not. Only if the behavior is (de)enabled or the element becomes visible the force field parameters are not modified if custom force field handling is enabled.
This behavior does require the element class to be persistable (setPersistable).
void Dragengine.Scenery.ECBehaviorForceField.addListenerFactory | ( | Block | blockFactory | ) |
void Dragengine.Scenery.ECBehaviorForceField.addListenerFactory | ( | ListenerFactory | factory | ) |
Add listener factory.
ECBehaviorInstance Dragengine.Scenery.ECBehaviorForceField.createInstance | ( | BehaviorElement | element | ) |
Create Behavior instance.
Implements Dragengine.Scenery.ECBehavior.
void Dragengine.Scenery.ECBehaviorForceField.dispose | ( | ) |
Dispose of behavior.
Reimplemented from Dragengine.Scenery.DefaultECBehavior.
void Dragengine.Scenery.ECBehaviorForceField.forEachListenerFactory | ( | Block | ablock | ) |
Visit listener factories with block with argument ListenerFactory.
|
static |
Get list of all behaviors in element.
Returns list contains ECBehaviorForceField behaviors in the order they have been created in the element.
|
static |
Get list of all instances in element.
Returns list contains ECBehaviorForceField.Instance instances in the order they have been created in the element.
ECComposeAttachResource Dragengine.Scenery.ECBehaviorForceField.getAttach | ( | ) |
Attach resource.
|
static |
Get behavior in element class or null if absent.
Use this method to check if a particular BehaviorElementClass contains a behavior of type ECBehaviorCollider.
|
static |
Get behavior with id in element class or null if absent.
Use this method to check if a particular BehaviorElementClass contains a behavior of type ECBehaviorForceField with specific identifier.
ECBehaviorCollider Dragengine.Scenery.ECBehaviorForceField.getCollider | ( | ) |
Collider behavior or null to not attach.
ECComposeForceField Dragengine.Scenery.ECBehaviorForceField.getForceField | ( | ) |
Composeable force field for element class.
|
static |
Get instance in element or null if absent.
Use this method to check if a particular BehaviorElement contains a behavior instance of type ECBehaviorForceField.Instance . If more than one instance is present returns the first instance.
|
static |
Get instance with id in element or null if absent.
Use this method to check if a particular BehaviorElement contains a behavior instance of type ECBehaviorForceField.Instance with specific identifier.
ECBehaviorForceField Dragengine.Scenery.ECBehaviorForceField.getSyncTrigger | ( | ) |
ECBehaviorForceField to synchronize triggers with or null to disable.
ECBehaviorTriggered Dragengine.Scenery.ECBehaviorForceField.getTrigger | ( | ) |
Trigger enable.
TSTriggerTable Dragengine.Scenery.ECBehaviorForceField.getTriggerTable | ( | ) |
Trigger table or null if not used.
Instance Dragengine.Scenery.ECBehaviorForceField.instance | ( | BehaviorElement | element | ) |
Get instance in element from owner element class.
ECBehaviorForceField Dragengine.Scenery.ECBehaviorForceField.new | ( | BehaviorElementClass | eclass, |
ECBehaviorCollider | collider | ||
) |
Create behavior element class.
These values are optional and can be null: collider.
ECBehaviorForceField Dragengine.Scenery.ECBehaviorForceField.new | ( | BehaviorElementClass | eclass, |
ECBehaviorCollider | collider, | ||
String | id | ||
) |
ECBehaviorForceField Dragengine.Scenery.ECBehaviorForceField.new | ( | BehaviorElementClass | eclass, |
ECBehaviorCollider | collider, | ||
TSTriggerTable | triggerTable | ||
) |
ECBehaviorForceField Dragengine.Scenery.ECBehaviorForceField.new | ( | BehaviorElementClass | eclass, |
ECBehaviorCollider | collider, | ||
TSTriggerTable | triggerTable, | ||
String | id | ||
) |
ECBehaviorForceField Dragengine.Scenery.ECBehaviorForceField.new | ( | BehaviorElementClass | eclass, |
ECBehaviorCollider | collider, | ||
TSTriggerTable | triggerTable, | ||
String | id, | ||
String | subID | ||
) |
ECBehaviorForceField Dragengine.Scenery.ECBehaviorForceField.new | ( | BehaviorElementClass | eclass, |
ECBehaviorCollider | collider, | ||
TSTriggerTable | triggerTable, | ||
String | id, | ||
String | subID, | ||
String | prefix | ||
) |
void Dragengine.Scenery.ECBehaviorForceField.setSyncTrigger | ( | ECBehaviorForceField | behavior | ) |
ECBehaviorForceField to synchronize triggers with or null to disable.
|
protected |
Set trigger table or null if not used.