|
Drag[en]gine Script Module DragonScript 1.32.1
|
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 | Factory |
| Behavior factory. More... | |
| interface | Listener |
| Listener for behavior instance events. More... | |
| interface | ListenerFactory |
| Factory creating listeners. More... | |
Additional Inherited Members | |
Public Member Functions inherited from Dragengine.Scenery.DefaultECBehavior | |
| void | assignInstanceIndex (int instanceIndex) |
| Assign instance index. | |
| void | dispose () |
| Dispose of behavior. | |
| String | getBehaviorID () |
| Unique identifier of behavior. | |
| String | getID () |
| Identifier. | |
| int | getInstanceIndex () |
| Instance index. | |
| void | loadSupportedData (String identifier, PersistencyEnvironment env, FileReader reader, ECBehaviorInstance instance) |
| Load instance data of another behavior. | |
| bool | supportsBehaviorID (String identifier) |
| Behavior supports loading instance data of another behavior. | |
Public Member Functions inherited from Dragengine.Scenery.ECBehavior | |
| ECBehaviorInstance | createInstance (BehaviorElement element) |
| Create Behavior instance. | |
Protected Member Functions inherited from Dragengine.Scenery.DefaultECBehavior | |
| DefaultECBehavior | new (BehaviorElementClass eclass) |
| Create default composeable behavior with empty identifier. | |
| DefaultECBehavior | new (BehaviorElementClass eclass, String id) |
| Create default composeable behavior. | |
| void | setBehaviorID (String identifier) |
| Set behavior identifier. | |
| void | useClassNameAsBehaviorID () |
| Set behavior identifier to "<class-name>:<identifier>". | |
| void | useFullyQualifiedClassNameAsBehaviorID () |
| Set behavior identifier to "<fully-qualified-class-name>:<identifier>". | |
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).