NOTE:Formore in depth information on code access, please take a look at the official documentation pdf here:
http://www.tanukidigital.com/tenkoku/documentationAccessing variables via script is very easy. All you have to do is cache a reference to the main module and then you can directly edit specific variables from anywhere in your project...
First Reference main module... private var tenkokuModule : TenkokuModule;
function Start () {
tenkokuModule = GameObject.Find("Tenkoku DynamicSky").GetComponent(TenkokuModule) as TenkokuModule;
}
Then you can access/change any of the time variables... tenkokuModule.currentYear = 2015;
tenkokuModule.currentMonth = 3;
tenkokuModule.currentDay = 21;
tenkokuModule.currentHour = 7;
tenkokuModule.currentMinute = 30;
tenkokuModule.currentSecond =0;
And you can set position variables... tenkokuModule.setLatitude = 40.2;
tenkokuModule.setLongitude = 0.0;
And you can set weather variables... tenkokuModule.weather_cloudAltoStratusAmt = 0.1;
tenkokuModule.weather_cloudCirrusAmt = 0.2;
tenkokuModule.weather_cloudCumulusAmt = 0.5;
tenkokuModule.weather_OvercastAmt = 0.0;
tenkokuModule.weather_cloudScale = 1.0;
tenkokuModule.weather_cloudSpeed = 0.2;
tenkokuModule.weather_RainAmt = 0.0;
tenkokuModule.weather_SnowAmt = 0.0;
tenkokuModule.weather_FogAmt = 0.0;
tenkokuModule.weather_WindAmt = 0.3;
tenkokuModule.weather_WindDir = 180.0;
Or you can setup and trigger the automatic(random) weather generator...the below will turn on the auto weather, set the weather pattern to play for 5 minutes, and set the between-pattern transition to about 10 seconds. However it's best to also set a boolean variable (below called randomizePattern) so that you can force a new pattern update when you want to.
tenkokuModule.weatherTypeIndex = 1;
tenkokuModule.weather_autoForecastTime = 5.0;
tenkokuModule.weather_TransitionTime = 0.1;
if (randomizePattern){
randomizePattern = false;
tenkokuModule.weather_forceUpdate = true;
}
You can also set the tracking camera from code...The below code snippet will allow you to change the currently tacked camera by setting the "useCamera" variable. This is useful if you need to switch between multiple cameras during your game, or if you instantiate your player/camera from code.
#pragma strict
var useCamera : Transform;
private var tenkokuModule : TenkokuModule;
function Start () {
tenkokuModule = GameObject.Find("Tenkoku DynamicSky").GetComponent(TenkokuModule) as TenkokuModule;
}
function LateUpdate () {
if (tenkokuModule != null){
if (useCamera != null){
tenkokuModule.mainCamera = useCamera;
}
}
}