24 lines
839 B
JavaScript
24 lines
839 B
JavaScript
|
GameLib.D3.ComponentColorFlash = function(
|
||
|
componentId
|
||
|
) {
|
||
|
this.componentId = componentId || GameLib.D3.Tools.RandomId();
|
||
|
this.parentEntity = null;
|
||
|
|
||
|
// Todo: this should be executed somewhere in game-lib-z, so that we don't execute it on every construction of an object.
|
||
|
GameLib.D3.Utils.Extend(GameLib.D3.ComponentColorFlash, GameLib.D3.ComponentInterface);
|
||
|
};
|
||
|
|
||
|
///////////////////////// Methods to override //////////////////////////
|
||
|
GameLib.D3.ComponentColorFlash.prototype.onUpdate = function(
|
||
|
deltaTime,
|
||
|
parentEntity
|
||
|
) {
|
||
|
this.parentEntity.mesh.material.color = new THREE.Color(Math.random(), Math.random(), Math.random());
|
||
|
};
|
||
|
|
||
|
GameLib.D3.ComponentColorFlash.prototype.onSetParentEntity = function(
|
||
|
parentScene,
|
||
|
parentEntity
|
||
|
) {
|
||
|
parentEntity.mesh.material = new THREE.MeshBasicMaterial();
|
||
|
};
|