Start Page » DragonScript Scripting Language » Abstraction Layers: How you want to build your Game » Behavior Elements » ECBehaviorDecal
Behavior element behavior adding decal projected onto ECBehaviorComponent.
This behavior can be used multiple times on an element to add multiple decals to mainpulate. Use the behavior identifier to tell them apart.
Element class properties have the prefix decal.
or decal({id}).
if id is not empty.
Set position relative to component to project decal from.
decal.position
or decal({id}).position
<vector name='decal.position' x='0' y='0' z='0.1'/>
Set orientation relative to component to project decal from.
decal.orientation
or decal({id}).orientation
<vector name='decal.orientation' x='30' y='0' z='0'/>
Set size of decal to project. The X and Y coordinates are the size of the decal. The Z coordinate is the projection distance. The decal does not apply beyond this distance.
decal.size
or decal({id}).size
<vector name='decal.size' x='0.2' y='0.1' z='0.1'/>
Set path of skin resource to use.
decal.skin
or decal({id}).skin
*.deskin
<string name='decal.skin'>box.deskin</string>
This behavior has no events.
This behavior does not support optional behaviors.
This behavior does not require the element class to be persistable (setPersistable).
Since DragonScript Module Version 1.0
This example defines an element which adds a decal to the component.
class MyElement extends BehaviorElementClass public var ECBehaviorComponent component public var ECBehaviorDecal decal func new() // add component to add decal to component = ECBehaviorComponent.new(this) // add decal. it will only show on this component. you can add multiple decals // to the same component or to different components decal = ECBehaviorDecal.new(this, component) decal.getSkin().setPath("/content/decals/mark.deskin") 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'> <!-- add component to add decal to --> <behavior type='ECBehaviorComponent'/> <!-- add decal to component --> <behavior type='ECBehaviorDecal'> <!-- optional: use component with id instead of empty string --> <!-- <string name='component'>second</string> --> <!-- set element properties. omit property prefix if used inside behavior tag --> <string name='.skin'>mark.deskin</string> </behavior> <!-- for adding multiple behaviors use unique identifiers --> <behavior type='ECBehaviorDecal' id='second'> ... </behavior> </elementClass>