|
| void | dispose () |
| | Dispose of behavior.
|
| |
| ECPInteger | getActive () |
| | Index of initially active skin property.
|
| |
| ECComposeBTSM | getBTSMs () |
| | Compose behavior trees and state machines.
|
| |
| ECPBoolean | getClamp () |
| | Clamp property.
|
| |
| ECBehaviorComponent | getComponent () |
| | Component behavior.
|
| |
| String | getPrefix () |
| | Prefix.
|
| |
| ECPSkinList | getSkins () |
| | Skins property.
|
| |
| ECPString | getTexture () |
| | Texture property.
|
| |
| void | listen (ECBehaviorAnimated behavior, BooleanListener.SwitchType switchType) |
| | Add listener factory to ECBehaviorAnimated behavior.
|
| |
| void | listen (ECBehaviorEvaluate behavior, BooleanListener.SwitchType switchType) |
| | Add listener factory to ECBehaviorEvaluate behavior.
|
| |
| void | listen (ECBehaviorTouching behavior, BooleanListener.SwitchType switchType) |
| | Add listener factory to ECBehaviorTouching behavior.
|
| |
| void | listen (ECBehaviorTouchSensor behavior, BooleanListener.SwitchType switchType) |
| | Add listener factory to ECBehaviorTouchSensor behavior.
|
| |
| void | listen (ECBehaviorTriggered behavior) |
| | Add listener factory with SwitchType.nextOnOff to ECBehaviorTriggered behavior.
|
| |
| void | listen (ECBehaviorTriggered behavior, BooleanListener.SwitchType switchType) |
| | Add listener factory to ECBehaviorTriggered behavior.
|
| |
| void | listen (ECBehaviorTwoStateAnimated behavior, BooleanListener.SwitchType switchType) |
| | Add listener factory to ECBehaviorTwoStateAnimated behavior.
|
| |
| ECBehaviorSkinSwitcher | new (BehaviorElementClass eclass, ECBehaviorComponent component) |
| | Create behavior element class.
|
| |
| ECBehaviorSkinSwitcher | new (BehaviorElementClass eclass, ECBehaviorComponent component, String id) |
| |
| ECBehaviorSkinSwitcher | new (BehaviorElementClass eclass, ECBehaviorComponent component, String id, String subId) |
| |
| ECBehaviorSkinSwitcher | new (BehaviorElementClass eclass, ECBehaviorComponent component, String id, String subId, String prefix) |
| |
| void | assignInstanceIndex (int instanceIndex) |
| | Assign instance index.
|
| |
| String | getBehaviorID () |
| | Unique identifier of behavior.
|
| |
| String | getID () |
| | Identifier.
|
| |
| int | getInstanceIndex () |
| | Instance index.
|
| |
| void | loadSupportedData (String identifier, PersistencyEnvironment env, FileReader reader, ECBehaviorInstance instance) |
| | Load instance data of another behavior.
|
| |
| bool | supportsBehaviorID (String identifier) |
| | Behavior supports loading instance data of another behavior.
|
| |
| ECBehaviorInstance | createInstance (BehaviorElement element) |
| | Create Behavior instance.
|
| |
Behavior element behavior adding support to switch component skins.
If a texture name is specified the matching component texture skin is switched instead of switching the skin for the entire component.
Switching skins can be used for example with monitors which show an offline skin and if used by the player switch to one or more online skins. Another use case is to create damageable objects which change skin the more they are damaged.
To use this behavior assign one or more skins to it. The first skin is used as the starting skin. By calling setActive() the active skin can be selected using the index of the skin in the list of defined skins. Furthermore activateNext() and activatePrevious() can be used to cycle through skins.
Optionally this behavior can be attached to various other behaviors supporting BooleanBehaviorListener. By doing so cycling though skins is attached to listener events called by other behaviors.
Skin switcher is set by default to wrap index around at the begin and end of the skin list. This allows to indefinitely cycle through all skins. By setting the "clamp" element class property to true the skins can cycle only once not wrapping around.
The example below switches the skin of a texture if the animated state become activate:
func new()
skinSwitcher.getTexture().setValue("display")
skinSwitcher.getSkins().add("/content/skins/displayOff.deskin")
skinSwitcher.getSkins().add("/content/skins/displayOn.deskin")
skinSwitcher.listen(animated)
end
end
Behavior element element class.
Definition BehaviorElementClass.ds:54
Behavior element behavior adding collider support.
Definition ECBehaviorCollider.ds:147
Behavior element behavior adding component support.
Definition ECBehaviorComponent.ds:103
Behavior element behavior adding support to switch component skins.
Definition ECBehaviorSkinSwitcher.ds:139
Behavior element behavior adding two state animation support.
Definition ECBehaviorTwoStateAnimated.ds:109
Multiple instances of ECBehaviorSkinSwitcher can be used for example to switch skins of multiple component textures. To use multiple instances use code like this in your subclass constructor:
func new()
skinSwitcher.getTexture().setValue("display")
skinSwitcher.getSkins().add("/content/skins/displayOff.deskin")
skinSwitcher.getSkins().add("/content/skins/displayOn.deskin")
skinSwitcher.listen(animated)
subSkinSwitcher.getTexture().setValue("subDisplay")
subSkinSwitcher.getSkins().add("/content/skins/subDisplayOff.deskin")
subSkinSwitcher.getSkins().add("/content/skins/subDisplayOn.deskin")
subSkinSwitcher.listen(animated)
end
end
Element class properties have the prefix "skinSwitcher{(id)}.".
This behavior does support element class to be persistable (setPersistable). Saves active skin index.
- See also
- https://developer.dragondreams.ch/wiki/doku.php/dragengine:modules:dragonscript:behavior_skinswitcher