51 lines
1.3 KiB
JavaScript
51 lines
1.3 KiB
JavaScript
|
/**
|
||
|
* This component makes the parentEntity (ex. car) follow the path provided by the spline
|
||
|
* @param id String
|
||
|
* @param name String
|
||
|
* @param domElementId
|
||
|
* @param pathFollowingComponent GameLib.D3.Mesh
|
||
|
* @param parentEntity
|
||
|
* @constructor
|
||
|
*/
|
||
|
GameLib.D3.API.Input.Drive = function (
|
||
|
id,
|
||
|
name,
|
||
|
domElementId,
|
||
|
pathFollowingComponent,
|
||
|
parentEntity
|
||
|
) {
|
||
|
GameLib.Component.call(
|
||
|
this,
|
||
|
GameLib.Component.COMPONENT_INPUT_DRIVE,
|
||
|
{
|
||
|
'pathFollowingComponent' : GameLib.D3.PathFollowing
|
||
|
},
|
||
|
null,
|
||
|
parentEntity
|
||
|
);
|
||
|
|
||
|
if (GameLib.Utils.UndefinedOrNull(id)) {
|
||
|
id = GameLib.Utils.RandomId();
|
||
|
}
|
||
|
this.id = id;
|
||
|
|
||
|
if (GameLib.Utils.UndefinedOrNull(name)) {
|
||
|
name = this.constructor.name;
|
||
|
}
|
||
|
this.name = name;
|
||
|
|
||
|
if (GameLib.Utils.UndefinedOrNull(domElementId)) {
|
||
|
domElementId = "divCanvas";
|
||
|
}
|
||
|
this.domElementId = domElementId;
|
||
|
|
||
|
if (GameLib.Utils.UndefinedOrNull(pathFollowingComponent)) {
|
||
|
pathFollowingComponent = null;
|
||
|
}
|
||
|
this.pathFollowingComponent = pathFollowingComponent;
|
||
|
|
||
|
};
|
||
|
|
||
|
GameLib.D3.API.Input.Drive.prototype = Object.create(GameLib.Component.prototype);
|
||
|
GameLib.D3.API.Input.Drive.prototype.constructor = GameLib.D3.API.Input.Drive;
|