Start Page » DragonScript Scripting Language » Abstraction Layers: How you want to build your Game » Behavior Elements » ECBehaviorDayTimeSky
Behavior element behavior adding day time sky support.
Updates day time controller of a day time supporting sky assigned to ECBehaviorSky. To use add ECBehaviorSky and ECBehaviorDayTimeSky to behavior element then call setDayTime() to adjust the day time to show.
This behavior can be used only once on an element.
Element class properties have the prefix customColor.
.
Set name of day time controller.
customColor.controllerDayTime
daytime
<string name='customColor.controllerDayTime'>daytime</string>
Set day time as hour of day in the range from 0 to 24.
customColor.dayTime
10
0
and at most 24
<float name='customColor.dayTime'>10.75</float>
This behavior has no events.
This behavior does not support optional behaviors.
This behavior does support element class to be persistable (setPersistable).
Since DragonScript Module Version 1.0
This example defines an element which uses daytime driven sky.
class MyElement extends BehaviorElementClass public var ECBehaviorSky sky public var ECBehaviorDayTimeSky dayTimeSky func new() sky = ECBehaviorSky.new(this) dayTimeSky = ECBehaviorDayTimeSky.new(this, sky) 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='ECBehaviorSky'/> <behavior type='ECBehaviorDayTimeSky'> <!-- set element properties. omit property prefix if used inside behavior tag --> <string name='.controllerDayTime'>daytime</string> </behavior> </elementClass>