Skyline Lua API  Version 1.0
Lua Script Reference for Skyline Game Engine.
env Class Reference

#include <LUA_API_Environment.h>

Public Member Functions

void setTOD_Time (float time)
 Set the time of day in a 24 hr clock. More...
 
float getTOD_Time ()
 Get the time of day in a 24 hr clock mode. More...
 
void setTOD_TimeMultiplier (float speedMulti)
 Set the time speed multiplier. More...
 
float getTOD_TimeMultiplier ()
 Get the time of day speed multiplier. More...
 
void setTOD_Enabled (int enabled)
 Set whether the TOD Sky Movement is enabled or not. More...
 
int getTOD_Enabled ()
 Get whether the TOD Sky Movement is enabled. More...
 

Detailed Description

This area covers Environemnt functions to control Time of day and Ocean systems. Use as env.function(); For more information on how these functions can be used please visit the User Manual - https://home.aurasoft-skyline.co.uk

To use these functions, you will need to activate the dynamic sky.

obj = 0;
function onInit(objID)
    obj = objID;
    sky.print("Scene Script Acitve");
    env.setTOD_Enabled(1);
    env.setTOD_TimeMultiplier(50);
end

function onUpdate( td )
    TOD_time = env.getTOD_Time();
    sky.print("TOD_time:"..TOD_time,1);
end

function onKeyDown( key )
    if(key == "1")then
        sky.print("Setting sky to morning",1);
        env.setTOD_Time(6);
    end
    
    if(key == "2")then
        sky.print("Setting sky to noon",1);
        env.setTOD_Time(12);
    end
    
    if(key == "3")then
        sky.print("Setting sky to evening",1);
        env.setTOD_Time(20);
    end 
    
    if(key == "4")then
        sky.print("Setting sky to midnight",1);
        env.setTOD_Time(24);
    end
end

function onStop( )
    env.setTOD_Enabled(0);
end

Member Function Documentation

int env::getTOD_Enabled ( )

Get whether the TOD Sky Movement is enabled.

Returns
enabled : 1 = true; 0 = false

Here is a Small Example of how to use this function:

function onUpdate(td)
    enabled = env.getTOD_Enabled();
    sky.print("enabled: "..enabled, 1);
end
float env::getTOD_Time ( )

Get the time of day in a 24 hr clock mode.

24/0 - midnight, 6 - sunrise, 12 - noon, 22 - sunset

Returns
time : The current time of day returned as a float.

Here is a Small Example of how to use this function:

function onUpdate(td)
    dayTime = env.getTOD_Time();
    sky.print("dayTime: "..dayTime, 1);
end
float env::getTOD_TimeMultiplier ( )

Get the time of day speed multiplier.

Returns
speedMulti : The speed multiplier to returned from the Dynamic sky.

Here is a Small Example of how to use this function:

function onUpdate(td)
    speedMulti = env.getTOD_TimeMultiplier();
    sky.print("speedMulti: "..speedMulti, 1);
end
void env::setTOD_Enabled ( int  enabled)

Set whether the TOD Sky Movement is enabled or not.

Parameters
enabled: 1 = true; 0 = false

Here is a Small Example of how to use this function:

obj = 0;
function onInit( objID )
    objID = obj;
    env.setTOD_Enabled(1); -- turn movement on
    env.setTOD_Enabled(0); -- turn movement off
end
void env::setTOD_Time ( float  time)

Set the time of day in a 24 hr clock.

24/0 - midnight, 6 - sunrise, 12 - noon, 22 - sunset

Parameters
time: The time of day to change to. Must be done in 24 hr clock.

Here is a Small Example of how to use this function:

function onUpdate(td)
    env.setTOD_Time(12); -- midday , sun rises at 6 and goes down at 10
end
void env::setTOD_TimeMultiplier ( float  speedMulti)

Set the time speed multiplier.

Parameters
speedMulti: The speed multiplier for the time of day progress.

Here is a Small Example of how to use this function:

function onUpdate(td)
    env.setTOD_TimeMultiplier(2); -- run at 2x speed.
    env.setTOD_Time(12); -- midday , sun rises at 6 and goes down at 10
end

The documentation for this class was generated from the following file: