Drag[en]gine Script Module DragonScript
1.21
|
Behavior element behavior adding light 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 | addShadowIgnoreComponent (ECBehaviorComponent component) |
Add component to ignore while casting shadows. 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... | |
void | forEachShadowIgnoreComponent (Block ablock) |
Visit components to ignore while casting shadows using block with parameter ECBehaviorComponent. More... | |
ECComposeAttachResource | getAttach () |
Attach resource. More... | |
ECBehaviorCollider | getCollider () |
Collider behavior or null to not attach. More... | |
ECComposeLight | getLight () |
Composeable light for element class. More... | |
ECBehaviorLight | getSyncTrigger () |
ECBehaviorLight to synchronize triggers with or null to disable. More... | |
ECBehaviorTriggered | getTrigger () |
Trigger activate. More... | |
TSTriggerTable | getTriggerTable () |
Trigger table or null if not used. More... | |
Instance | instance (BehaviorElement element) |
Get instance in element from owner element class. More... | |
ECBehaviorLight | new (BehaviorElementClass eclass, ECBehaviorCollider collider) |
Create behavior element class. More... | |
ECBehaviorLight | new (BehaviorElementClass eclass, ECBehaviorCollider collider, String id) |
ECBehaviorLight | new (BehaviorElementClass eclass, ECBehaviorCollider collider, TSTriggerTable triggerTable) |
ECBehaviorLight | new (BehaviorElementClass eclass, ECBehaviorCollider collider, TSTriggerTable triggerTable, String id) |
ECBehaviorLight | new (BehaviorElementClass eclass, ECBehaviorCollider collider, TSTriggerTable triggerTable, String id, String subID) |
ECBehaviorLight | new (BehaviorElementClass eclass, ECBehaviorCollider collider, TSTriggerTable triggerTable, String id, String subID, String prefix) |
void | setSyncTrigger (ECBehaviorLight behavior) |
Set ECBehaviorLight 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 ECBehaviorLight | getBehaviorIn (BehaviorElementClass eclass) |
Get behavior in element class or null if absent. More... | |
static ECBehaviorLight | 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 light support.
Behavior adds a Light resource to the the behavior element. This behavior can be added multiple times to an element. Each instance creates one light attached to the element collider which can be individually modified. To distinguish the lights each instance has an identifier which can be used to retrieve a specific instance. The prefix of the light class properties is "light." . If the identifier is not empty the light element class properties have the prefix "{id}.light.". This can be overwritten if required. Hence to use more than one light use code like this in your subclass constructor:
You can now define the parameters to use for both lights using for example the properties "color" for the first light and "subLight.color" for the second light.
It is recommended to always specify an identifier even if only one light 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 light is attached. The light is attached to the named bone if defined otherwise it is attached statically.
Element class properties have the prefix "light{(id)}.".
The owner element class and other behaviors can register a listener to be notified if the light is (de)activated. This can be used to provide customized light handling support for example flickering or dimmable lights.
If another behaviors wants to control the light parameters in response to these events it should call setCustomLightHandling(true). In this case the behavior implementing the light parameter handling has to use requiresThink() to think while the effect lasts.
The activated state of the light source is linked with the visibility state of the owner element. If the owner element becomes invisible the light resource is always deactivated. If the owner element becomes visible the light resource is activated if the behavior is activated too.
If custom light handling is used the behavior resposible for the custom light handling is required to listen to stateChanged() calls and act accordingly. The light resource will be always activated no matter if the custom light handling is enabled or not. Only if the behavior is (de)activated or the element becomes visible the light parameters are not modified if custom light handling is enabled.
This behavior does require the element class to be persistable (setPersistable).
void Dragengine.Scenery.ECBehaviorLight.addListenerFactory | ( | Block | blockFactory | ) |
void Dragengine.Scenery.ECBehaviorLight.addShadowIgnoreComponent | ( | ECBehaviorComponent | component | ) |
Add component to ignore while casting shadows.
ECBehaviorInstance Dragengine.Scenery.ECBehaviorLight.createInstance | ( | BehaviorElement | element | ) |
Create Behavior instance.
Implements Dragengine.Scenery.ECBehavior.
void Dragengine.Scenery.ECBehaviorLight.dispose | ( | ) |
Dispose of behavior.
Reimplemented from Dragengine.Scenery.DefaultECBehavior.
void Dragengine.Scenery.ECBehaviorLight.forEachListenerFactory | ( | Block | ablock | ) |
Visit listener factories with block with argument ListenerFactory.
void Dragengine.Scenery.ECBehaviorLight.forEachShadowIgnoreComponent | ( | Block | ablock | ) |
Visit components to ignore while casting shadows using block with parameter ECBehaviorComponent.
|
static |
Get list of all behaviors in element.
Returns list contains ECBehaviorLight behaviors in the order they have been created in the element.
|
static |
Get list of all instances in element.
Returns list contains ECBehaviorLight.Instance instances in the order they have been created in the element.
ECComposeAttachResource Dragengine.Scenery.ECBehaviorLight.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 ECBehaviorLight with specific identifier.
ECBehaviorCollider Dragengine.Scenery.ECBehaviorLight.getCollider | ( | ) |
Collider behavior or null to not attach.
|
static |
Get instance in element or null if absent.
Use this method to check if a particular BehaviorElement contains a behavior instance of type ECBehaviorLight.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 ECBehaviorLight.Instance with specific identifier.
ECComposeLight Dragengine.Scenery.ECBehaviorLight.getLight | ( | ) |
Composeable light for element class.
ECBehaviorLight Dragengine.Scenery.ECBehaviorLight.getSyncTrigger | ( | ) |
ECBehaviorLight to synchronize triggers with or null to disable.
ECBehaviorTriggered Dragengine.Scenery.ECBehaviorLight.getTrigger | ( | ) |
Trigger activate.
TSTriggerTable Dragengine.Scenery.ECBehaviorLight.getTriggerTable | ( | ) |
Trigger table or null if not used.
Instance Dragengine.Scenery.ECBehaviorLight.instance | ( | BehaviorElement | element | ) |
Get instance in element from owner element class.
ECBehaviorLight Dragengine.Scenery.ECBehaviorLight.new | ( | BehaviorElementClass | eclass, |
ECBehaviorCollider | collider | ||
) |
Create behavior element class.
These values are optional and can be null: collider.
ECBehaviorLight Dragengine.Scenery.ECBehaviorLight.new | ( | BehaviorElementClass | eclass, |
ECBehaviorCollider | collider, | ||
String | id | ||
) |
ECBehaviorLight Dragengine.Scenery.ECBehaviorLight.new | ( | BehaviorElementClass | eclass, |
ECBehaviorCollider | collider, | ||
TSTriggerTable | triggerTable | ||
) |
ECBehaviorLight Dragengine.Scenery.ECBehaviorLight.new | ( | BehaviorElementClass | eclass, |
ECBehaviorCollider | collider, | ||
TSTriggerTable | triggerTable, | ||
String | id | ||
) |
ECBehaviorLight Dragengine.Scenery.ECBehaviorLight.new | ( | BehaviorElementClass | eclass, |
ECBehaviorCollider | collider, | ||
TSTriggerTable | triggerTable, | ||
String | id, | ||
String | subID | ||
) |
ECBehaviorLight Dragengine.Scenery.ECBehaviorLight.new | ( | BehaviorElementClass | eclass, |
ECBehaviorCollider | collider, | ||
TSTriggerTable | triggerTable, | ||
String | id, | ||
String | subID, | ||
String | prefix | ||
) |
void Dragengine.Scenery.ECBehaviorLight.setSyncTrigger | ( | ECBehaviorLight | behavior | ) |
Set ECBehaviorLight to synchronize triggers with or null to disable.
|
protected |
Set trigger table or null if not used.