Start Page » DragonScript Scripting Language » Behavior Elements: Quick and Easy Development » ECBehaviorNStateGeometry
Behavior element behavior adding geometry network state support.
If ECBehaviorNetworkState is present and activate adds network values to synchronize the owner element position and orientation.
This behavior can be used only once on an element.
Element class properties have the prefix nstateGeometry.
.
This behavior has no events.
This behavior does not support optional behaviors.
This behavior does not required element class to be persistable (setPersistable).
Since DragonScript Module Version 1.0
This example defines an element which synchronizes geometry state of element using network state.
class MyElement extends BehaviorElementClass public var ECBehaviorNetworkState networkState public var ECBehaviorNStateGeometry nstateGeometry func new() networkState = ECBehaviorComponent.new(this, 1, 1) nstateGeometry = ECBehaviorNStateGeometry.new(this, networkState) 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='ECBehaviorNetworkState'> <integer name='requestLinkCode'>1</integer> <integer name='messageCode'>1</integer> </behavior> <behavior type='ECBehaviorNStateGeometry'> <!-- optional: position precision. default is 0.001 --> <float name='precisionPosition'>0.01</float> <!-- optional: orientation precision. default is 0.001 --> <float name='precisionOrientation'>0.01</float> <!-- set element properties. omit property prefix if used inside behavior tag --> <string name='.name'>value</string> </behavior> </elementClass>