2017-01-12 04:44:01 +01:00
|
|
|
/**
|
|
|
|
* 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;
|
|
|
|
};
|
|
|
|
|
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
|
|
|
|
*/
|
|
|
|
GameLib.API.System.FromObjectComponent = function(objectComponent) {
|
|
|
|
return new GameLib.API.System(
|
|
|
|
objectComponent.id,
|
|
|
|
objectComponent.name,
|
|
|
|
objectComponent.systemType,
|
|
|
|
objectComponent.entityManager,
|
|
|
|
objectComponent.parentEntity
|
|
|
|
);
|
|
|
|
};
|