r3-legacy/src/game-lib-api-clock.js

47 lines
990 B
JavaScript
Raw Normal View History

/**
* Raw Clock API object - should always correspond with the Clock Schema
* @constructor
* @param id
* @param name
* @param parentEntity
*/
GameLib.API.Clock = function(
id,
name,
parentEntity
) {
if (GameLib.Utils.UndefinedOrNull(id)) {
id = GameLib.Utils.RandomId();
}
this.id = id;
if (GameLib.Utils.UndefinedOrNull(name)) {
name = 'Clock (' + this.id + ')';
}
this.name = name;
if (GameLib.Utils.UndefinedOrNull(parentEntity)) {
parentEntity = null;
}
this.parentEntity = parentEntity;
};
GameLib.API.Clock.prototype = Object.create(GameLib.Component.prototype);
GameLib.API.Clock.prototype.constructor = GameLib.API.Clock;
/**
* Creates an API camera from an Object camera
* @param objectClock
* @constructor
*/
GameLib.API.Clock.FromObject = function(objectClock) {
return new GameLib.API.Clock(
objectClock.id,
objectClock.name,
objectClock.parentEntity
);
};