r3-legacy/bak/game-lib-d3-api-input-edito...

63 lines
1.5 KiB
JavaScript
Raw Normal View History

2017-01-10 17:04:30 +01:00
/**
* This component makes the parentEntity (ex. car) follow the path provided by the spline
* @param id String
* @param name String
2017-02-21 18:55:18 +01:00
* @param domElement
2017-01-10 17:04:30 +01:00
* @param camera
* @param parentEntity
* @constructor
*/
GameLib.D3.API.Input.Editor = function (
id,
name,
2017-02-21 18:55:18 +01:00
domElement,
2017-01-10 17:04:30 +01:00
camera,
parentEntity
) {
if (GameLib.Utils.UndefinedOrNull(id)) {
id = GameLib.Utils.RandomId();
}
this.id = id;
if (GameLib.Utils.UndefinedOrNull(name)) {
2017-01-13 16:19:51 +01:00
name = 'Input Editor (' + this.id + ')';
2017-01-10 17:04:30 +01:00
}
this.name = name;
2017-02-21 18:55:18 +01:00
if (GameLib.Utils.UndefinedOrNull(domElement)) {
domElement = null;
2017-01-10 17:04:30 +01:00
}
2017-02-21 18:55:18 +01:00
this.domElement = domElement;
2017-01-13 16:19:51 +01:00
2017-01-10 17:04:30 +01:00
if (GameLib.Utils.UndefinedOrNull(camera)) {
camera = null;
}
this.camera = camera;
2017-01-12 17:40:17 +01:00
2017-06-16 15:49:53 +02:00
if (GameLib.Utils.UndefinedOrNull(parentEntity)) {
parentEntity = null;
}
this.parentEntity = parentEntity;
2017-01-10 17:04:30 +01:00
};
GameLib.D3.API.Input.Editor.prototype = Object.create(GameLib.Component.prototype);
GameLib.D3.API.Input.Editor.prototype.constructor = GameLib.D3.API.Input.Editor;
/**
* Object to GameLib.D3.API.Input.Editor
* @param objectComponent
* @returns {GameLib.D3.API.Input.Editor}
* @constructor
*/
2017-06-14 14:21:57 +02:00
GameLib.D3.API.Input.Editor.FromObject = function(objectComponent) {
2017-01-10 17:04:30 +01:00
return new GameLib.D3.API.Input.Editor(
objectComponent.id,
objectComponent.name,
2017-02-21 18:55:18 +01:00
objectComponent.domElement,
2017-01-10 17:04:30 +01:00
objectComponent.camera,
objectComponent.parentEntity
);
};