47 lines
1.1 KiB
JavaScript
47 lines
1.1 KiB
JavaScript
|
/**
|
||
|
* This component makes the parentEntity (ex. car) follow the path provided by the spline
|
||
|
* @param id String
|
||
|
* @param name String
|
||
|
* @param object
|
||
|
* @param helper
|
||
|
* @param lastUpdate
|
||
|
* @constructor
|
||
|
*/
|
||
|
R3.D3.API.SelectedObject = function (
|
||
|
object,
|
||
|
helper,
|
||
|
lastUpdate
|
||
|
) {
|
||
|
if (R3.Utils.UndefinedOrNull(object)) {
|
||
|
console.warn('Cannot select no object');
|
||
|
throw new Error('Cannot select no object');
|
||
|
}
|
||
|
this.object = object;
|
||
|
|
||
|
if (R3.Utils.UndefinedOrNull(helper)) {
|
||
|
helper = null;
|
||
|
}
|
||
|
this.helper = helper;
|
||
|
|
||
|
if (R3.Utils.UndefinedOrNull(lastUpdate)) {
|
||
|
lastUpdate = Date.now();
|
||
|
}
|
||
|
this.lastUpdate = lastUpdate;
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Object to R3.D3.API.SelectedObject
|
||
|
* @param objectComponent
|
||
|
* @returns {R3.D3.API.SelectedObject}
|
||
|
* @constructor
|
||
|
*/
|
||
|
R3.D3.API.SelectedObject.FromObjectSelectedObject = function(objectComponent) {
|
||
|
return new R3.D3.API.SelectedObject(
|
||
|
objectComponent.id,
|
||
|
objectComponent.name,
|
||
|
objectComponent.object,
|
||
|
objectComponent.helper,
|
||
|
objectComponent.lastUpdate
|
||
|
);
|
||
|
};
|