Class: Environment

Class contents

Methods list

These are special functions (or methods) that you may call on the object. these functions typically instruct the object to perform a certain operation.

Events list

Events are functions you add to your objects, that will be called by Cubiverse when certain things (events) occur.
    No events

Class Information

Constructor

new Environment()

You cannot instigate a Environment directly from normal Java-script code, it is created automatically by Cubiverse and varilable as the global ENVIRONMENT variable.
Important:
  • You cannot instigate a Environment directly from normal Java-script code, it is created automatically by Cubiverse and varilable as the global ENVIRONMENT variable.

Methods

getTimeOfDay()

Gets the current "Time Of Day"

Returns the time of day in seconds

Example
var currentTime = ENVIRONMENT.getTimeOfDay() 

setTimeOfDay(seconds)

Sets the current "Time Of Day" affecting the lighting in the world

Every world has a time of day, reflecting the position of the sun and therefore daylight. The time of day is measured in seconds from zero (midnight or 00:00:00) to 86439 seconds (or 23:59:59). You must not exceed the value of 86439, otherwise a Cubiverse exceptional will occur; if you require the time to cycle ensure that when you reach 86439 you reset your variable to zero. {enum} lightType The light to be created

Parameters:
Name Type Description
seconds integer The current time, expressed as seconds from 0 (00:00:00) to 86439 (23:59:59).

Example
// Set the time of day to 8pm (i.e. 8 hours x 60 minutes x 60 seconds)
ENVIRONMENT.setTimeOfDay( 8 * 60 * 60 ) ;