Start Page » DragonScript Scripting Language » Abstraction Layers: How you want to build your Game » Behavior Elements » ECBehaviorInteraction
Behavior element behavior adding storing supported interactions.
This behavior can be used only once on an element.
This behavior adds no element class properties.
This behavior has no event
This behavior adds no behavior tree actions.
This behavior adds no behavior tree conditions.
This behavior adds no state machine actions.
This behavior adds no state machine conditions.
This behavior does not send state machine events.
This behavior requires no other behaviors.
This behavior supports no optional behaviors.
This behavior does not required element class to be persistable (setPersistable)
Since DragonScript Module Version 1.26
This example defines an element which contains a interaction. The “MyBehaviorWithInteraction” class has to add an instance of a class implementing ECBehaviorInteraction.Interaction to “interaction”. This can be for example an interaction named “frob” which triggers for a ECBehaviorTwoStateAnimated behavior.
class MyElement extends BehaviorElementClass public var ECBehaviorInteraction interaction public var MyBehaviorWithInteraction myBehavior func new() interaction = ECBehaviorInteraction.new(this) myBehavior = MyBehaviorWithInteraction.new(this, interaction) end end
Using element class supporting adding behaviors the behavior can be added like this:
<?xml version='1.0' encoding='UTF-8'?> <elementClass name='MyClass' class='GenericBehaviorElement'> <behavior type='ECBehaviorInteraction'/> </elementClass>