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

Behavior element behavior adding force field support. More...

Inheritance diagram for Dragengine.Scenery.ECBehaviorForceField:
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 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...
 

Detailed Description

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:

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

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

Listening and Customized ForceField Handling

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.

Owner Element Visibility

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

Member Function Documentation

◆ addListenerFactory() [1/2]

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

Add listener factory using block.

Block receives as parameter Instance and returns Listener.

◆ addListenerFactory() [2/2]

void Dragengine.Scenery.ECBehaviorForceField.addListenerFactory ( ListenerFactory  factory)

Add listener factory.

◆ createInstance()

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

Create Behavior instance.

Implements Dragengine.Scenery.ECBehavior.

◆ dispose()

void Dragengine.Scenery.ECBehaviorForceField.dispose ( )

Dispose of behavior.

Reimplemented from Dragengine.Scenery.DefaultECBehavior.

◆ forEachListenerFactory()

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

Visit listener factories with block with argument ListenerFactory.

◆ getAllBehaviorsIn()

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

Get list of all behaviors in element.

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

◆ getAllInstancesIn()

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

◆ getAttach()

ECComposeAttachResource Dragengine.Scenery.ECBehaviorForceField.getAttach ( )

Attach resource.

◆ getBehaviorIn() [1/2]

static ECBehaviorForceField Dragengine.Scenery.ECBehaviorForceField.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 ECBehaviorForceField Dragengine.Scenery.ECBehaviorForceField.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 ECBehaviorForceField with specific identifier.

◆ getCollider()

ECBehaviorCollider Dragengine.Scenery.ECBehaviorForceField.getCollider ( )

Collider behavior or null to not attach.

◆ getForceField()

ECComposeForceField Dragengine.Scenery.ECBehaviorForceField.getForceField ( )

Composeable force field for element class.

◆ getInstanceIn() [1/2]

static Instance Dragengine.Scenery.ECBehaviorForceField.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 ECBehaviorForceField.Instance . If more than one instance is present returns the first instance.

◆ getInstanceIn() [2/2]

static Instance Dragengine.Scenery.ECBehaviorForceField.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 ECBehaviorForceField.Instance with specific identifier.

◆ getSyncTrigger()

ECBehaviorForceField Dragengine.Scenery.ECBehaviorForceField.getSyncTrigger ( )

ECBehaviorForceField to synchronize triggers with or null to disable.

◆ getTrigger()

ECBehaviorTriggered Dragengine.Scenery.ECBehaviorForceField.getTrigger ( )

Trigger enable.

◆ getTriggerTable()

TSTriggerTable Dragengine.Scenery.ECBehaviorForceField.getTriggerTable ( )

Trigger table or null if not used.

◆ instance()

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

Get instance in element from owner element class.

◆ new() [1/6]

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

Create behavior element class.

These values are optional and can be null: collider.

◆ new() [2/6]

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

◆ new() [3/6]

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

◆ new() [4/6]

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

◆ new() [5/6]

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

◆ new() [6/6]

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

◆ setSyncTrigger()

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

ECBehaviorForceField to synchronize triggers with or null to disable.

◆ setTriggerTable()

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

Set trigger table or null if not used.


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