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

54 lines
1.2 KiB
JavaScript
Raw Normal View History

2017-01-12 04:44:01 +01:00
/**
* This component renders a scene
* @param id String
* @param name String
* @param systemType
* @param parentEntity
* @constructor
*/
GameLib.API.System = function (
id,
name,
systemType,
parentEntity
) {
if (GameLib.Utils.UndefinedOrNull(id)) {
id = GameLib.Utils.RandomId();
}
this.id = id;
if (GameLib.Utils.UndefinedOrNull(name)) {
name = "System (" + this.id + ")";
}
this.name = name;
if (GameLib.Utils.UndefinedOrNull(systemType)) {
systemType = GameLib.System.SYSTEM_TYPE_RENDER;
}
this.systemType = systemType;
2017-06-16 15:49:53 +02:00
if (GameLib.Utils.UndefinedOrNull(parentEntity)) {
parentEntity = null;
}
this.parentEntity = parentEntity;
2017-01-12 04:44:01 +01:00
};
2017-01-19 17:50:11 +01:00
GameLib.API.System.prototype = Object.create(GameLib.Component.prototype);
GameLib.API.System.prototype.constructor = GameLib.API.System;
2017-01-12 04:44:01 +01:00
/**
* Object to GameLib.D3.API.System
* @param objectComponent
* @constructor
*/
2017-06-14 14:21:57 +02:00
GameLib.API.System.FromObject = function(objectComponent) {
2017-01-12 04:44:01 +01:00
return new GameLib.API.System(
objectComponent.id,
objectComponent.name,
objectComponent.systemType,
objectComponent.parentEntity
);
};