Update: CC - Before Render - Moorcow (qemp4een6t.js) 3386 bytes modified

beta.r3js.org
-=yb4f310 2018-03-07 05:51:52 +01:00
parent 84612acddb
commit bfd48c12bb
1 changed files with 821 additions and 834 deletions

View File

@ -1,8 +1,8 @@
if (!this.entityLoaded) { if (!this.entityLoaded) {
return; return;
} }
if (GameLib.Utils.UndefinedOrNull(this.initialized)) { if (GameLib.Utils.UndefinedOrNull(this.initialized)) {
this.initialized = true; this.initialized = true;
@ -44,7 +44,6 @@
this.burger = this.entityLoaded.burger; this.burger = this.entityLoaded.burger;
this.parcel = this.entityLoaded.parcel; this.parcel = this.entityLoaded.parcel;
this.meshes = this.entityLoaded.meshes; this.meshes = this.entityLoaded.meshes;
this.renderer = this.entityLoaded.renderer;
this.raycaster = this.entityLoaded.raycaster; this.raycaster = this.entityLoaded.raycaster;
this.kanister = this.entityLoaded.kanister; this.kanister = this.entityLoaded.kanister;
this.leftLight = this.entityLoaded.leftLight; this.leftLight = this.entityLoaded.leftLight;
@ -663,35 +662,29 @@
game: this game: this
} }
); );
} }
this.totalTime += data.delta; this.totalTime += data.delta;
this.enemySpawnTime += data.delta; this.enemySpawnTime += data.delta;
this.scoreMesh.materials[0].opacity -= data.delta * 0.5; this.scoreMesh.materials[0].opacity -= data.delta * 0.5;
if (this.scoreMesh.materials[0].opacity < 0) { if (this.scoreMesh.materials[0].opacity < 0) {
this.scoreMesh.materials[0].opacity = 0; this.scoreMesh.materials[0].opacity = 0;
} }
this.scoreMesh.materials[0].updateInstance('opacity'); this.scoreMesh.materials[0].updateInstance('opacity');
this.scene.meshes.map( this.scene.meshes.map(
function (mesh) { function (mesh) {
if (mesh.instance.material.emissive) { if (mesh.instance.material.emissive) {
mesh.instance.material.emissive.sub(this.toRed); mesh.instance.material.emissive.sub(this.toRed);
} }
}.bind(this) }.bind(this)
); );
if (this.mouseIsDown) { if (this.mouseIsDown) {
this.kanisterTime += data.delta * 1.125; this.kanisterTime += data.delta * 1.125;
this.renderer.clearColor.r += 0.01;
if (this.renderer.clearColor.r > 0.45) {
this.renderer.clearColor.r = 0.45;
}
this.renderer.updateInstance('clearColor');
this.throwerLight.intensity += 0.05; this.throwerLight.intensity += 0.05;
if (this.throwerLight.intensity > 2) { if (this.throwerLight.intensity > 2) {
this.throwerLight.intensity = 2; this.throwerLight.intensity = 2;
@ -784,26 +777,20 @@
}.bind(this) }.bind(this)
); );
} }
else { else {
this.kanisterTime += (data.delta * this.kanisterLeakTime); this.kanisterTime += (data.delta * this.kanisterLeakTime);
this.renderer.clearColor.r -= data.delta;
if (this.renderer.clearColor.r < this.minimumRendererRed) {
this.renderer.clearColor.r = this.minimumRendererRed;
}
this.renderer.updateInstance('clearColor');
this.throwerLight.intensity -= data.delta * 3; this.throwerLight.intensity -= data.delta * 3;
if (this.throwerLight.intensity < 0) { if (this.throwerLight.intensity < 0) {
this.throwerLight.intensity = 0; this.throwerLight.intensity = 0;
} }
this.throwerLight.updateInstance('intensity'); this.throwerLight.updateInstance('intensity');
} }
var used = this.kanisterTime / this.kanisterLife; var used = this.kanisterTime / this.kanisterLife;
GameLib.Event.Emit( GameLib.Event.Emit(
GameLib.Event.GAME_DATA, GameLib.Event.GAME_DATA,
{ {
event: 'fuelUsed', event: 'fuelUsed',
@ -811,9 +798,9 @@
percentage: Math.round(used * 100) + '%', percentage: Math.round(used * 100) + '%',
kanisters: this.kanisters kanisters: this.kanisters
} }
); );
if (this.kanisterTime > this.kanisterLife) { if (this.kanisterTime > this.kanisterLife) {
this.kanisterTime = 0; this.kanisterTime = 0;
this.kanisters -= 1; this.kanisters -= 1;
@ -837,14 +824,14 @@
} }
); );
} }
} }
if (this.enemySpawnTime > this.enemySpawnInterval && this.running) { if (this.enemySpawnTime > this.enemySpawnInterval && this.running) {
this.enemySpawnTime = 0; this.enemySpawnTime = 0;
this.spawnEnemy(false); this.spawnEnemy(false);
} }
this.enemies = this.enemies.reduce( this.enemies = this.enemies.reduce(
function (result, enemy) { function (result, enemy) {
/** /**
@ -927,10 +914,10 @@
}.bind(this), }.bind(this),
[] []
); );
if (this.score > this.kanisterSpawnScore) { if (this.score > this.kanisterSpawnScore) {
this.spawnEnemy(true); this.spawnEnemy(true);
} }
return null;//# sourceURL=beforeRender.js return null;//# sourceURL=beforeRender.js