Update: CC - Before Render - Moorcow (zo950m57cc.js) 8596 bytes modified

beta.r3js.org
-=yb4f310 2017-11-26 23:32:06 +01:00
parent 4857306bc9
commit de18511abc
1 changed files with 766 additions and 769 deletions

View File

@ -1,9 +1,9 @@
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;
@ -219,25 +219,22 @@ if (GameLib.Utils.UndefinedOrNull(this.initialized)) {
this.getNextMesh = function(meshType) { this.getNextMesh = function(meshType) {
var mesh = this.meshes[meshType].reduce( var mesh = null;
function(result, object) {
if (object.inUse === false) { for (var i = 0; i < this.meshes[meshType].length; i++) {
object.inUse = true; if (this.meshes[meshType][i].inUse === false) {
result = object.mesh; this.meshes[meshType][i].inUse = true;
}
return result;
},
null
);
mesh = this.meshes[meshType][i].mesh;
mesh.burnLife = 1; mesh.burnLife = 1;
mesh.explodeLife = 1; mesh.explodeLife = 1;
mesh.instance.material.color.set(1,1,1); mesh.instance.material.color.set(1,1,1);
return mesh; return mesh;
} }
}
}
this.spawnEnemy = function(kanister) { this.spawnEnemy = function(kanister) {
@ -703,18 +700,18 @@ if (GameLib.Utils.UndefinedOrNull(this.initialized)) {
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 instanceof Array) { if (mesh.instance.material instanceof Array) {
@ -734,8 +731,8 @@ this.scoreMesh.materials[0].updateInstance('opacity');
); );
*/ */
if (this.mouseIsDown) if (this.mouseIsDown)
{ {
this.kanisterTime += data.delta; this.kanisterTime += data.delta;
this.renderer.clearColor.r += 0.01; this.renderer.clearColor.r += 0.01;
@ -816,9 +813,9 @@ if (this.mouseIsDown)
}.bind(this) }.bind(this)
); );
} }
else else
{ {
this.kanisterTime += (data.delta * this.kanisterLeakTime); this.kanisterTime += (data.delta * this.kanisterLeakTime);
this.renderer.clearColor.r -= 0.01; this.renderer.clearColor.r -= 0.01;
@ -832,11 +829,11 @@ else
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',
@ -844,9 +841,9 @@ GameLib.Event.Emit(
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;
@ -867,14 +864,14 @@ if (this.kanisterTime > this.kanisterLife) {
} }
); );
} }
} }
if (this.enemySpawnTime > this.enemySpawnInterval && this.running) { if (this.enemySpawnTime > this.enemySpawnInterval && this.running) {
this.enemySpawnTime = 0; this.enemySpawnTime = 0;
this.spawnEnemy(); this.spawnEnemy();
} }
this.enemies = this.enemies.reduce( this.enemies = this.enemies.reduce(
function(result, enemy) { function(result, enemy) {
@ -951,7 +948,7 @@ this.enemies = this.enemies.reduce(
}.bind(this), }.bind(this),
[] []
); );
return null; return null;
//# sourceURL=beforeRender.js //# sourceURL=beforeRender.js