Table of Contents

,

Start Page » DragonScript Scripting Language » Abstraction Layers: How you want to build your Game » Behavior Elements » ECBehaviorDecal

ECBehaviorDecal

Behavior element behavior adding decal projected onto ECBehaviorComponent.

Instance Counts

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

Element class properties have the prefix decal. or decal({id}). if id is not empty.

position

Set position relative to component to project decal from.

orientation

Set orientation relative to component to project decal from.

size

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.

skin

Set path of skin resource to use.

Events

This behavior has no events.

Required Behaviors

Optional Behaviors

This behavior does not support optional behaviors.

Persistency

This behavior does not require the element class to be persistable (setPersistable).

API Documentation

ECBehaviorDecal.

Since DragonScript Module Version 1.0

Use Cases

Element Class Example

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

Behavior Factory

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>

Live Examples