2018-03-07 14:03:56 +01:00
|
|
|
if (!this.entityLoaded) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!this.initialized) {
|
|
|
|
|
2018-03-07 17:28:34 +01:00
|
|
|
/**
|
|
|
|
* Meshes
|
|
|
|
*/
|
|
|
|
this.road = this.entityLoaded.road;
|
|
|
|
this.cloud = this.entityLoaded.cloud;
|
|
|
|
|
|
|
|
this.time = 0;
|
|
|
|
|
|
|
|
this.spawnCloud = function() {
|
2018-03-07 17:35:12 +01:00
|
|
|
this.cloud.position.x = 5;
|
|
|
|
this.cloud.position.z = (Math.random() * 0.2) - 0.1
|
2018-03-07 17:28:34 +01:00
|
|
|
this.cloud.updateInstance('position');
|
|
|
|
}
|
2018-03-07 14:03:56 +01:00
|
|
|
|
|
|
|
this.initialized = true;
|
|
|
|
}
|
|
|
|
|
2018-03-07 17:32:17 +01:00
|
|
|
|
2018-03-07 14:18:01 +01:00
|
|
|
this.road.rotation.z += 0.004 * data.delta;
|
2018-03-07 14:03:56 +01:00
|
|
|
this.road.updateInstance('rotation');
|
|
|
|
|
2018-03-07 17:35:12 +01:00
|
|
|
this.cloud.position.x -= data.delta;
|
|
|
|
this.cloud.updateInstance('position');
|
2018-03-07 17:28:34 +01:00
|
|
|
|
|
|
|
this.time += data.delta;
|
|
|
|
|
2018-03-07 17:35:12 +01:00
|
|
|
if (this.time > 5) {
|
|
|
|
this.spawnCloud();
|
2018-03-07 17:28:34 +01:00
|
|
|
this.time = 0;
|
|
|
|
}
|
|
|
|
|
2018-03-07 14:03:56 +01:00
|
|
|
//@ sourceURL=beforeRender.js
|