Update: CC - Before Render - Moorcow (orfy8cilgg.js) 526 bytes modified
parent
c34e1872eb
commit
2547647ef1
|
@ -459,7 +459,9 @@ if (GameLib.Utils.UndefinedOrNull(this.initialized)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var explodeParticleEngine = this.explodeParticleEngine.clone();
|
var explodeParticleEngine = this.explodeParticleEngine.clone();
|
||||||
explodeParticleEngine.position = mesh.position.clone();
|
explodeParticleEngine.position.x = mesh.position.x;
|
||||||
|
explodeParticleEngine.position.y = mesh.position.y;
|
||||||
|
explodeParticleEngine.position.z = mesh.position.z;
|
||||||
explodeParticleEngine.updateInstance('position');
|
explodeParticleEngine.updateInstance('position');
|
||||||
explodeParticleEngine.enabled = true;
|
explodeParticleEngine.enabled = true;
|
||||||
mesh.explodeParticleEngine = explodeParticleEngine;
|
mesh.explodeParticleEngine = explodeParticleEngine;
|
||||||
|
@ -881,23 +883,12 @@ if (this.enemySpawnTime > this.enemySpawnInterval && this.running) {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.enemies = this.enemies.reduce(
|
this.enemies = this.enemies.reduce(
|
||||||
|
|
||||||
function(result, enemy) {
|
function(result, enemy) {
|
||||||
|
|
||||||
if (enemy.exploding === true) {
|
/**
|
||||||
/**
|
* Update enemy position and rotation
|
||||||
* We need to wait one render cycle for the smoke explode particle engine
|
*/
|
||||||
* and then kill the enemy
|
|
||||||
*/
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(enemy.waiting)) {
|
|
||||||
enemy.waiting = true;
|
|
||||||
result.push(enemy);
|
|
||||||
} else {
|
|
||||||
this.kill(enemy);
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
enemy.mesh.position.x += enemy.velocity.x * data.delta * 60;
|
enemy.mesh.position.x += enemy.velocity.x * data.delta * 60;
|
||||||
enemy.mesh.position.y += enemy.velocity.y * data.delta * 60;
|
enemy.mesh.position.y += enemy.velocity.y * data.delta * 60;
|
||||||
enemy.mesh.position.z += enemy.velocity.z * data.delta * 60;
|
enemy.mesh.position.z += enemy.velocity.z * data.delta * 60;
|
||||||
|
@ -906,8 +897,10 @@ this.enemies = this.enemies.reduce(
|
||||||
enemy.mesh.quaternion.angle += enemy.rotation.angle * data.delta;
|
enemy.mesh.quaternion.angle += enemy.rotation.angle * data.delta;
|
||||||
enemy.mesh.updateInstance('quaternion');
|
enemy.mesh.updateInstance('quaternion');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update its lifetime
|
||||||
|
*/
|
||||||
enemy.lifeTime += data.delta;
|
enemy.lifeTime += data.delta;
|
||||||
|
|
||||||
if (enemy.lifeTime > enemy.life) {
|
if (enemy.lifeTime > enemy.life) {
|
||||||
|
|
||||||
GameLib.Event.Emit(
|
GameLib.Event.Emit(
|
||||||
|
@ -922,32 +915,54 @@ this.enemies = this.enemies.reduce(
|
||||||
* We only remove the things we cloned
|
* We only remove the things we cloned
|
||||||
*/
|
*/
|
||||||
this.kill(enemy);
|
this.kill(enemy);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (enemy.exploding === true) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* We need to wait one render cycle for the smoke explode particle engine
|
||||||
|
* and then kill the enemy
|
||||||
|
*/
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(enemy.waiting)) {
|
||||||
|
enemy.waiting = true;
|
||||||
|
result.push(enemy);
|
||||||
|
} else {
|
||||||
|
this.kill(enemy);
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
if (enemy.burning) {
|
||||||
|
|
||||||
if (enemy.burning) {
|
|
||||||
|
|
||||||
|
if (!enemy.exploding) {
|
||||||
enemy.burnTime += data.delta;
|
enemy.burnTime += data.delta;
|
||||||
|
|
||||||
if (enemy.burnTime > enemy.burnLife) {
|
if (enemy.burnTime > enemy.burnLife) {
|
||||||
enemy.mesh.smokeParticleEngine.remove();
|
|
||||||
enemy.mesh.fireParticleEngine.remove();
|
|
||||||
this.explode(enemy.mesh);
|
this.explode(enemy.mesh);
|
||||||
} else {
|
|
||||||
enemy.mesh.smokeParticleEngine.position = enemy.mesh.position.clone();
|
|
||||||
enemy.mesh.smokeParticleEngine.updateInstance('position');
|
|
||||||
enemy.mesh.fireParticleEngine.position = enemy.mesh.position.clone();
|
|
||||||
enemy.mesh.fireParticleEngine.updateInstance('position');
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (enemy.mesh.smokeParticleEngine) {
|
||||||
|
enemy.mesh.smokeParticleEngine.position.x = enemy.mesh.position.x;
|
||||||
|
enemy.mesh.smokeParticleEngine.position.y = enemy.mesh.position.y;
|
||||||
|
enemy.mesh.smokeParticleEngine.position.z = enemy.mesh.position.z;
|
||||||
|
enemy.mesh.smokeParticleEngine.updateInstance('position');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (enemy.mesh.fireParticleEngine) {
|
||||||
|
enemy.mesh.fireParticleEngine.position.x = enemy.mesh.position.x;
|
||||||
|
enemy.mesh.fireParticleEngine.position.y = enemy.mesh.position.y;
|
||||||
|
enemy.mesh.fireParticleEngine.position.z = enemy.mesh.position.z;
|
||||||
|
enemy.mesh.fireParticleEngine.updateInstance('position');
|
||||||
}
|
}
|
||||||
|
|
||||||
result.push(enemy);
|
result.push(enemy);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
|
||||||
}.bind(this),
|
}.bind(this),
|
||||||
[]
|
[]
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue