{{tag>dragonscript behavior}} [[:start|Start Page]] >> [[main|DragonScript Scripting Language]] >> [[dragengine:modules:dragonscript:abstractions|Abstraction Layers: How you want to build your Game]] >> [[dragengine:modules:dragonscript:behavior_elements|Behavior Elements]] >> **ECBehaviorDayTimeSky** * [[behaviors_use_cases|Behaviors Explained: By Use-Case]] * [[behaviors_a_to_z|Behaviors Explained: From A to Z]] ====== ECBehaviorDayTimeSky ====== Behavior element behavior adding day time sky support. Updates day time controller of a day time supporting sky assigned to [[behavior_sky|ECBehaviorSky]]. To use add [[behavior_sky|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) daytime ===== 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) 10.75 ====== Events ====== This behavior has no events. ====== Behavior Tree Actions ====== This behavior adds these behavior tree actions if behavior tree is present. If behavior has non-empty identifier replace ''dayTimeSky'' with ''dayTimeSky(id)''. ===== dayTimeSky.set ===== Set one or more day time sky parameters. ^Parameter^Value^Description^ |time|float|Set day time as hour of day| This is an example of using this action: 8.5 ===== dayTimeSky.check ===== Check one or more day time sky parameters. Action succeeds if all parameter value matches their respective day time sky parameter otherwise action fails. This action is typically used as first action in a sequence to run the sequence only if a day time sky parameter matches (or not). ^Parameter^Value^Description^ |time.less|float|Day time is less than hour of day| |time.greater|float|Day time is greater than hour of day| |wait| |If present action returns BTResult.running instead of BTResult.failed to wait until the checks are all fulfilled| This is an example of using this action: 6.5 ====== Behavior Tree Conditions ====== This behavior adds these behavior tree conditions if behavior tree is present. If behavior has non-empty identifier replace ''dayTimeSky'' with ''dayTimeSky(id)''. ===== dayTimeSky.check ===== Check one or more day time sky parameters. Conditions returns true if all parameter value match their respective day time sky parameter. This condition is typically used to run an action or sequence of actions as long as day time sky conditions are true. ^Parameter^Value^Description^ |dayTimeSky.time.less|float|Day time is less than hour of day| |dayTimeSky.time.greater|float|Day time is greater than hour of day| This is an example of using this condition: 6.5 dayTimeSky.check ====== State Machine Actions ====== Same as [[#behavior_tree_actions|Behavior Tree Actions]]. ====== State Machine Conditions ====== Same as [[#behavior_tree_conditions|Behavior Tree Conditions]]. ====== State Machine Events ====== This behavior sends no state machine events. ====== Required Behaviors ====== * [[behavior_sky|ECBehaviorSky]] ====== Optional Behaviors ====== * [[behavior_behaviortree|ECBehaviorBehaviorTree]]: Add actions and conditions for behavior trees to use. * [[behavior_statemachine|ECBehaviorStateMachine]]: Add actions and conditions for state machine to use and events to send to the state machine. ====== Persistency ====== This behavior does support element class to be persistable (setPersistable). ====== API Documentation ====== #@LinkApiDocDEDS2_HTML~classDragengine_1_1Scenery_1_1ECBehaviorDayTimeSky.html,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: second second daytime ====== Live Examples ====== * [[https://github.com/LordOfDragons/deexamples|DEExamples Repository]]