{{tag>dragonscript behavior}}
[[:start|Start Page]] >> [[main|DragonScript Scripting Language]] >> [[abstractions#behavior_elementsquick_and_easy_development|Behavior Elements: Quick and Easy Development]] >> **ECBehaviorNStateLocomotion**
* [[behaviors_use_cases|Behaviors Explained: By Use-Case]]
* [[behaviors_a_to_z|Behaviors Explained: From A to Z]]
====== ECBehaviorNStateLocomotion ======
Behavior element behavior adding locomotion state support.
If [[behavior_networkstate|ECBehaviorNetworkState]] is present and activate adds network values to synchronize [[behavior_locomotion|ECBehaviorLocomotion]] certain values.
====== Instance Counts ======
This behavior can be used only once on an element.
====== Element Class Properties ======
Element class properties have the prefix ''nstateLocomotion.'' .
====== Events ======
This behavior has no events.
====== Required Behaviors ======
* [[behavior_locomotion|ECBehaviorLocomotion]]
* [[behavior_networkstate|ECBehaviorNetworkState]]
====== Optional Behaviors ======
This behavior does not support optional behaviors.
====== Persistency ======
This behavior does not required element class to be persistable (setPersistable).
====== API Documentation ======
#@LinkApiDocDEDS2_HTML~classDragengine_1_1Scenery_1_1ECBehaviorNStateLocomotion.html,ECBehaviorNStateLocomotion~@#.
Since DragonScript Module Version ''1.0''
====== Use Cases ======
* Add support to synchronize [[behavior_locomotion|ECBehaviorLocomotion]] state using [[behavior_networkstate|ECBehaviorNetworkState]].
====== Element Class Example ======
This example defines an element which can synchronize locomotion state using network state.
class MyElement extends BehaviorElementClass
public var ECBehaviorComponent component
public var ECBehaviorCollider collider
public var ECBehaviorColliderAI colliderAI
public var ECBehaviorLocomotion locomotion
public var ECBehaviorNetworkState networkState
public var ECBehaviorNStateLocomotion nstateLocomotion
func new()
component = ECBehaviorComponent.new(this, null)
collider = ECBehaviorCollider.new(this, component)
colliderAI = ECBehaviorColliderAI.new(this, collider)
locomotion = ECBehaviorLocomotion.new(this, colliderAI)
networkState = ECBehaviorNetworkState.new(this, 1, 1)
nstateLocomotion = ECBehaviorNStateLocomotion.new(this, locomotion, networkState)
end
end
====== Behavior Factory ======
Using element class supporting adding behaviors the behavior can be added like this:
1
1
0.1
0.1
0.1
0.1
0.1
value
====== Live Examples ======
* [[https://github.com/LordOfDragons/deexamples|DEExamples Repository]]