User Tools

Site Tools


dragengine:modules:dragonscript:behavior_daytimesky

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.

Instance Counts

This behavior can be used only once on an element.

Element Class Properties

Element class properties have the prefix customColor. .

controllerDayTime

Set name of day time controller.

  • Full name: customColor.controllerDayTime
  • Type: string
  • Default Value: daytime
  • Example (*.deeclass)
    <string name='customColor.controllerDayTime'>daytime</string>

dayTime

Set day time as hour of day in the range from 0 to 24.

  • Full name: customColor.dayTime
  • Type: float
  • Default Value: 10
  • Restriction: At least 0 and at most 24
  • Example (*.deeclass)
    <float name='customColor.dayTime'>10.75</float>

Events

This behavior has no events.

Required Behaviors

Optional Behaviors

This behavior does not support optional behaviors.

Persistency

This behavior does support element class to be persistable (setPersistable).

API Documentation

ECBehaviorDayTimeSky.

Since DragonScript Module Version 1.0

Use Cases

  • Adjust sky instance parameters using day time as sky controller input.

Element Class Example

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

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'>
  <behavior type='ECBehaviorSky'/>
 
  <behavior type='ECBehaviorDayTimeSky'>
    <!-- set element properties. omit property prefix if used inside behavior tag -->
    <string name='.controllerDayTime'>daytime</string>
  </behavior>
</elementClass>

Live Examples

You could leave a comment if you were logged in.
dragengine/modules/dragonscript/behavior_daytimesky.txt · Last modified: 2025/03/13 17:15 by dragonlord