Drag[en]gine Script Module DragonScript  1.23
Dragengine.Scenery.ECBehaviorLight Class Reference

Behavior element behavior adding light support. More...

Inheritance diagram for Dragengine.Scenery.ECBehaviorLight:
Dragengine.Scenery.DefaultECBehavior Dragengine.Scenery.ECBehavior Dragengine.Scenery.BehaviorCompatiblePersistency

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

Detailed Description

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:

class MyElement extends BehaviorElementClass
public func new()
ECBehaviorLight.new(this)
ECBehaviorLight.new(this, "subLight")
end
end
ECBehaviorLight new(BehaviorElementClass eclass, ECBehaviorCollider collider)
Create behavior element class.

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)}.".

Listening and Customized Light Handling

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.

Owner Element Visibility

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

Member Function Documentation

◆ addListenerFactory()

void Dragengine.Scenery.ECBehaviorLight.addListenerFactory ( Block  blockFactory)

Add listener factory using block.

Block receives as parameter Instance and returns Listener.

◆ addShadowIgnoreComponent()

void Dragengine.Scenery.ECBehaviorLight.addShadowIgnoreComponent ( ECBehaviorComponent  component)

Add component to ignore while casting shadows.

Version
1.4

◆ createInstance()

ECBehaviorInstance Dragengine.Scenery.ECBehaviorLight.createInstance ( BehaviorElement  element)

Create Behavior instance.

Implements Dragengine.Scenery.ECBehavior.

◆ dispose()

void Dragengine.Scenery.ECBehaviorLight.dispose ( )

Dispose of behavior.

Reimplemented from Dragengine.Scenery.DefaultECBehavior.

◆ forEachListenerFactory()

void Dragengine.Scenery.ECBehaviorLight.forEachListenerFactory ( Block  ablock)

Visit listener factories with block with argument ListenerFactory.

◆ forEachShadowIgnoreComponent()

void Dragengine.Scenery.ECBehaviorLight.forEachShadowIgnoreComponent ( Block  ablock)

Visit components to ignore while casting shadows using block with parameter ECBehaviorComponent.

Version
1.4

◆ getAllBehaviorsIn()

static Array Dragengine.Scenery.ECBehaviorLight.getAllBehaviorsIn ( BehaviorElementClass  eclass)
static

Get list of all behaviors in element.

Returns list contains ECBehaviorLight behaviors in the order they have been created in the element.

◆ getAllInstancesIn()

static Array Dragengine.Scenery.ECBehaviorLight.getAllInstancesIn ( BehaviorElement  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.

◆ getAttach()

ECComposeAttachResource Dragengine.Scenery.ECBehaviorLight.getAttach ( )

Attach resource.

◆ getBehaviorIn() [1/2]

static ECBehaviorLight Dragengine.Scenery.ECBehaviorLight.getBehaviorIn ( BehaviorElementClass  eclass)
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.

◆ getBehaviorIn() [2/2]

static ECBehaviorLight Dragengine.Scenery.ECBehaviorLight.getBehaviorIn ( BehaviorElementClass  eclass,
String  id 
)
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.

◆ getCollider()

ECBehaviorCollider Dragengine.Scenery.ECBehaviorLight.getCollider ( )

Collider behavior or null to not attach.

◆ getInstanceIn() [1/2]

static Instance Dragengine.Scenery.ECBehaviorLight.getInstanceIn ( BehaviorElement  element)
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.

◆ getInstanceIn() [2/2]

static Instance Dragengine.Scenery.ECBehaviorLight.getInstanceIn ( BehaviorElement  element,
String  id 
)
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.

◆ getLight()

ECComposeLight Dragengine.Scenery.ECBehaviorLight.getLight ( )

Composeable light for element class.

◆ getSyncTrigger()

ECBehaviorLight Dragengine.Scenery.ECBehaviorLight.getSyncTrigger ( )

ECBehaviorLight to synchronize triggers with or null to disable.

◆ getTrigger()

ECBehaviorTriggered Dragengine.Scenery.ECBehaviorLight.getTrigger ( )

Trigger activate.

◆ getTriggerTable()

TSTriggerTable Dragengine.Scenery.ECBehaviorLight.getTriggerTable ( )

Trigger table or null if not used.

◆ instance()

Instance Dragengine.Scenery.ECBehaviorLight.instance ( BehaviorElement  element)

Get instance in element from owner element class.

◆ new() [1/6]

ECBehaviorLight Dragengine.Scenery.ECBehaviorLight.new ( BehaviorElementClass  eclass,
ECBehaviorCollider  collider 
)

Create behavior element class.

These values are optional and can be null: collider.

◆ new() [2/6]

ECBehaviorLight Dragengine.Scenery.ECBehaviorLight.new ( BehaviorElementClass  eclass,
ECBehaviorCollider  collider,
String  id 
)

◆ new() [3/6]

ECBehaviorLight Dragengine.Scenery.ECBehaviorLight.new ( BehaviorElementClass  eclass,
ECBehaviorCollider  collider,
TSTriggerTable  triggerTable 
)

◆ new() [4/6]

ECBehaviorLight Dragengine.Scenery.ECBehaviorLight.new ( BehaviorElementClass  eclass,
ECBehaviorCollider  collider,
TSTriggerTable  triggerTable,
String  id 
)

◆ new() [5/6]

ECBehaviorLight Dragengine.Scenery.ECBehaviorLight.new ( BehaviorElementClass  eclass,
ECBehaviorCollider  collider,
TSTriggerTable  triggerTable,
String  id,
String  subID 
)

◆ new() [6/6]

ECBehaviorLight Dragengine.Scenery.ECBehaviorLight.new ( BehaviorElementClass  eclass,
ECBehaviorCollider  collider,
TSTriggerTable  triggerTable,
String  id,
String  subID,
String  prefix 
)

◆ setSyncTrigger()

void Dragengine.Scenery.ECBehaviorLight.setSyncTrigger ( ECBehaviorLight  behavior)

Set ECBehaviorLight to synchronize triggers with or null to disable.

◆ setTriggerTable()

void Dragengine.Scenery.ECBehaviorLight.setTriggerTable ( TSTriggerTable  triggerTable)
protected

Set trigger table or null if not used.


The documentation for this class was generated from the following file: