61 lines
1.2 KiB
JavaScript
61 lines
1.2 KiB
JavaScript
|
/**
|
||
|
* This component renders a scene
|
||
|
* @param id String
|
||
|
* @param name String
|
||
|
* @param systemType
|
||
|
* @param entityManager
|
||
|
* @param parentEntity
|
||
|
* @constructor
|
||
|
*/
|
||
|
GameLib.API.System = function (
|
||
|
id,
|
||
|
name,
|
||
|
systemType,
|
||
|
entityManager,
|
||
|
parentEntity
|
||
|
) {
|
||
|
|
||
|
GameLib.Component.call(
|
||
|
this,
|
||
|
GameLib.Component.COMPONENT_SYSTEM,
|
||
|
null,
|
||
|
null,
|
||
|
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;
|
||
|
|
||
|
if (GameLib.Utils.UndefinedOrNull(entityManager)) {
|
||
|
entityManager = null;
|
||
|
}
|
||
|
this.entityManager = entityManager;
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Object to GameLib.D3.API.System
|
||
|
* @param objectComponent
|
||
|
* @constructor
|
||
|
*/
|
||
|
GameLib.API.System.FromObjectComponent = function(objectComponent) {
|
||
|
return new GameLib.API.System(
|
||
|
objectComponent.id,
|
||
|
objectComponent.name,
|
||
|
objectComponent.systemType,
|
||
|
objectComponent.entityManager,
|
||
|
objectComponent.parentEntity
|
||
|
);
|
||
|
};
|