Update: CC - Before Render - Moorcow (autqzs1rvq.js) 2502 bytes modified

beta.r3js.org
-=yb4f310 2017-11-18 13:33:19 +01:00
parent 8742e5b07b
commit a911784238
1 changed files with 400 additions and 401 deletions

View File

@ -14,17 +14,17 @@ if (GameLib.Utils.UndefinedOrNull(this.initialized)) {
this.santa = this.entityLoaded.santa; this.santa = this.entityLoaded.santa;
this.renderer = this.entityLoaded.renderer; 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.scene = this.entityLoaded.scene; this.scene = this.entityLoaded.scene;
this.leftLight = this.entityLoaded.leftLight; this.leftLight = this.entityLoaded.leftLight;
this.rightLight = this.entityLoaded.rightLight; this.rightLight = this.entityLoaded.rightLight;
this.throwerLight = this.entityLoaded.throwerLight; this.throwerLight = this.entityLoaded.throwerLight;
this.smokeParticleEngine = this.entityLoaded.smokeParticleEngine; this.smokeParticleEngine = this.entityLoaded.smokeParticleEngine;
this.fireParticleEngine = this.entityLoaded.fireParticleEngine; this.fireParticleEngine = this.entityLoaded.fireParticleEngine;
this.burningTreeParticleEngine = this.entityLoaded.burningTreeParticleEngine; this.burningTreeParticleEngine = this.entityLoaded.burningTreeParticleEngine;
this.explodeParticleEngine = this.entityLoaded.explodeParticleEngine; this.explodeParticleEngine = this.entityLoaded.explodeParticleEngine;
this.minimumRendererRed = 0; this.minimumRendererRed = 0;
this.toBlack = new THREE.Color(0.05, 0.05, 0.05); this.toBlack = new THREE.Color(0.05, 0.05, 0.05);
this.toRed = new THREE.Color(0.02, 0, 0); this.toRed = new THREE.Color(0.02, 0, 0);
@ -35,25 +35,25 @@ if (GameLib.Utils.UndefinedOrNull(this.initialized)) {
this.parcel.instance.visible = false; this.parcel.instance.visible = false;
this.santa.instance.visible = false; this.santa.instance.visible = false;
this.treesBurning = 0; this.treesBurning = 0;
/** /**
* This component is initializing - set the total time to 0 * This component is initializing - set the total time to 0
*/ */
this.totalTime = 0; this.totalTime = 0;
this.spawnTime = 0; this.spawnTime = 0;
this.kanisterTime = 0; this.kanisterTime = 0;
this.kanisterLife = 16.344; this.kanisterLife = 16.344;
this.fuelFinished = false; this.fuelFinished = false;
this.level = 1; this.level = 1;
this.spawnInterval = 5; this.spawnInterval = 5;
this.score = 0; this.score = 0;
this.lives = 10; this.lives = 10;
this.enemies = []; this.enemies = [];
this.enemiesSpawned = 0; this.enemiesSpawned = 0;
GameLib.Event.Emit( GameLib.Event.Emit(
GameLib.Event.GET_GRAPHICS_IMPLEMENTATION, GameLib.Event.GET_GRAPHICS_IMPLEMENTATION,
@ -64,30 +64,30 @@ if (GameLib.Utils.UndefinedOrNull(this.initialized)) {
); );
//this.getNextSpawnTime = function() { //this.getNextSpawnTime = function() {
/*return GameLib.Utils.GetRandomIntInclusive( /*return GameLib.Utils.GetRandomIntInclusive(
1, 1,
1 1
);*/ );*/
//} //}
//this.nextSpawnTime = this.getNextSpawnTime(); //this.nextSpawnTime = this.getNextSpawnTime();
this.setLevelProperties = function() { this.setLevelProperties = function() {
this.prevLevel = this.level; this.prevLevel = this.level;
this.level = Math.floor(this.enemiesSpawned / 10) + 1; this.level = Math.floor(this.enemiesSpawned / 10) + 1;
if (this.prevLevel !== this.level) { if (this.prevLevel !== this.level) {
this.spawnInterval -= 1 / (this.level); this.spawnInterval -= 1 / (this.level);
} }
} }
this.spawnEnemy = function() { this.spawnEnemy = function() {
this.enemiesSpawned++; this.enemiesSpawned++;
this.setLevelProperties(); this.setLevelProperties();
var enemyType = GameLib.Utils.GetRandomIntInclusive(1, 5); var enemyType = GameLib.Utils.GetRandomIntInclusive(1, 5);
var meshType = GameLib.Utils.GetRandomIntInclusive(1, 5); var meshType = GameLib.Utils.GetRandomIntInclusive(1, 5);
@ -199,235 +199,235 @@ if (GameLib.Utils.UndefinedOrNull(this.initialized)) {
enemy.life = 10; enemy.life = 10;
enemy.exploding = false; enemy.exploding = false;
enemy.burning = false; enemy.burning = false;
enemy.burnLife = 3; enemy.burnLife = 3;
enemy.burnTime = 0; enemy.burnTime = 0;
enemy.explodingLife = 2; enemy.explodingLife = 2;
this.enemies.push(enemy); this.enemies.push(enemy);
} }
this.explodeMesh = function(mesh) { this.explodeMesh = function(mesh) {
mesh.visible = false; mesh.visible = false;
mesh.updateInstance('visible'); mesh.updateInstance('visible');
var sound = GameLib.Utils.GetRandomIntInclusive(1,3); var sound = GameLib.Utils.GetRandomIntInclusive(1,3);
var name = 'Audio - Blast 1'; var name = 'Audio - Blast 1';
if (sound === 2) { if (sound === 2) {
name = 'Audio - Blast 2'; name = 'Audio - Blast 2';
} }
if (sound === 3) { if (sound === 3) {
name = 'Audio - Blast 3'; name = 'Audio - Blast 3';
} }
this.blastSubscription = GameLib.Event.Subscribe( this.blastSubscription = GameLib.Event.Subscribe(
GameLib.Event.AUDIO_ENDED, GameLib.Event.AUDIO_ENDED,
function(data) { function(data) {
if (data.audio.name === name) { if (data.audio.name === name) {
if (this.blastSubscription) { if (this.blastSubscription) {
this.blastSubscription.remove(); this.blastSubscription.remove();
this.blastSubscription = null; this.blastSubscription = null;
var play = GameLib.Utils.GetRandomIntInclusive(1,3); var play = GameLib.Utils.GetRandomIntInclusive(1,3);
if (play === 1) { if (play === 1) {
GameLib.Event.Emit( GameLib.Event.Emit(
GameLib.Event.PLAY_AUDIO, GameLib.Event.PLAY_AUDIO,
{ {
name : 'Audio - Ho ho ho' name : 'Audio - Ho ho ho'
} }
); );
} }
} }
} }
}.bind(this) }.bind(this)
); );
GameLib.Event.Emit( GameLib.Event.Emit(
GameLib.Event.PLAY_AUDIO, GameLib.Event.PLAY_AUDIO,
{ {
name : name name : name
} }
); );
var explodeParticleEngine = this.explodeParticleEngine.clone(); var explodeParticleEngine = this.explodeParticleEngine.clone();
explodeParticleEngine.position = mesh.position.clone(); explodeParticleEngine.position = mesh.position.clone();
explodeParticleEngine.updateInstance('position'); explodeParticleEngine.updateInstance('position');
explodeParticleEngine.enabled = true; explodeParticleEngine.enabled = true;
mesh.explodeParticleEngine = explodeParticleEngine; mesh.explodeParticleEngine = explodeParticleEngine;
}; };
this.explode = function(mesh) { this.explode = function(mesh) {
this.enemies.map( this.enemies.map(
function(enemy) { function(enemy) {
if (enemy.mesh === mesh && !enemy.exploding) { if (enemy.mesh === mesh && !enemy.exploding) {
console.log('exploding enemy'); console.log('exploding enemy');
this.score += this.level * 100; this.score += this.level * 100;
enemy.exploding = true; enemy.exploding = true;
this.explodeMesh(mesh); this.explodeMesh(mesh);
} }
}.bind(this) }.bind(this)
); );
} }
this.explodeKanister = function() { this.explodeKanister = function() {
this.kanisterTime = 0; this.kanisterTime = 0;
this.fuelFinished = false; this.fuelFinished = false;
this.explodeMesh(this.kanister); this.explodeMesh(this.kanister);
} }
this.burn = function(mesh) { this.burn = function(mesh) {
this.enemies.map( this.enemies.map(
function(enemy) { function(enemy) {
if (enemy.mesh === mesh && !enemy.burning) { if (enemy.mesh === mesh && !enemy.burning) {
this.score += this.level * 10; this.score += this.level * 10;
console.log('burning enemy ' + mesh.name); console.log('burning enemy ' + mesh.name);
enemy.burning = true; enemy.burning = true;
var smokeParticleEngine = this.smokeParticleEngine.clone(); var smokeParticleEngine = this.smokeParticleEngine.clone();
smokeParticleEngine.position = mesh.position.clone(); smokeParticleEngine.position = mesh.position.clone();
smokeParticleEngine.updateInstance('position'); smokeParticleEngine.updateInstance('position');
smokeParticleEngine.enabled = true; smokeParticleEngine.enabled = true;
mesh.smokeParticleEngine = smokeParticleEngine; mesh.smokeParticleEngine = smokeParticleEngine;
GameLib.Event.Emit( GameLib.Event.Emit(
GameLib.Event.PLAY_AUDIO, GameLib.Event.PLAY_AUDIO,
{ {
name : 'Audio - Burning' name : 'Audio - Burning'
} }
); );
var fireParticleEngine = this.fireParticleEngine.clone(); var fireParticleEngine = this.fireParticleEngine.clone();
fireParticleEngine.position = mesh.position.clone(); fireParticleEngine.position = mesh.position.clone();
fireParticleEngine.updateInstance('position'); fireParticleEngine.updateInstance('position');
fireParticleEngine.enabled = true; fireParticleEngine.enabled = true;
mesh.fireParticleEngine = fireParticleEngine; mesh.fireParticleEngine = fireParticleEngine;
} }
}.bind(this) }.bind(this)
); );
} }
this.kill = function(enemy) { this.kill = function(enemy) {
/** /**
* We only remove the things we cloned * We only remove the things we cloned
*/ */
GameLib.Event.Emit( GameLib.Event.Emit(
GameLib.Event.REMOVE_COMPONENT, GameLib.Event.REMOVE_COMPONENT,
{ {
component : enemy.mesh.materials[0] component : enemy.mesh.materials[0]
} }
); );
GameLib.Event.Emit( GameLib.Event.Emit(
GameLib.Event.REMOVE_COMPONENT, GameLib.Event.REMOVE_COMPONENT,
{ {
component : enemy.mesh component : enemy.mesh
} }
); );
/** /**
* Also dispose of the THREE.js objects * Also dispose of the THREE.js objects
*/ */
enemy.mesh.instance.geometry.dispose(); enemy.mesh.instance.geometry.dispose();
enemy.mesh.instance.material.dispose(); enemy.mesh.instance.material.dispose();
if (enemy.mesh.smokeParticleEngine) { if (enemy.mesh.smokeParticleEngine) {
enemy.mesh.smokeParticleEngine.remove(); enemy.mesh.smokeParticleEngine.remove();
enemy.mesh.smokeParticleEngine = null; enemy.mesh.smokeParticleEngine = null;
} }
if (enemy.mesh.fireParticleEngine) { if (enemy.mesh.fireParticleEngine) {
enemy.mesh.fireParticleEngine.remove(); enemy.mesh.fireParticleEngine.remove();
enemy.mesh.fireParticleEngine = null; enemy.mesh.fireParticleEngine = null;
} }
if (enemy.mesh.explodeParticleEngine) { if (enemy.mesh.explodeParticleEngine) {
enemy.mesh.explodeParticleEngine.remove(); enemy.mesh.explodeParticleEngine.remove();
enemy.mesh.explodeParticleEngine = null; enemy.mesh.explodeParticleEngine = null;
} }
}; };
this.burnTree = function(mesh) { this.burnTree = function(mesh) {
if (mesh.burning) { if (mesh.burning) {
/** /**
* Do nothing, this tree is burning * Do nothing, this tree is burning
*/ */
} else { } else {
mesh.burning = true; mesh.burning = true;
this.treesBurning++; this.treesBurning++;
this.minimumRendererRed += 0.01; this.minimumRendererRed += 0.01;
if (mesh.position.x < 0) { if (mesh.position.x < 0) {
this.leftLight.intensity += 0.07; this.leftLight.intensity += 0.07;
if (this.leftLight.intensity >= 1) { if (this.leftLight.intensity >= 1) {
this.leftLight.intensity = 1; this.leftLight.intensity = 1;
} }
// this.leftLight.color.g -= 0.05; // this.leftLight.color.g -= 0.05;
// this.leftLight.color.b -= 0.05; // this.leftLight.color.b -= 0.05;
this.leftLight.updateInstance('intensity'); this.leftLight.updateInstance('intensity');
// this.leftLight.updateInstance('color'); // this.leftLight.updateInstance('color');
} else { } else {
this.rightLight.intensity += 0.07; this.rightLight.intensity += 0.07;
if (this.rightLight.intensity >= 1) { if (this.rightLight.intensity >= 1) {
this.rightLight.intensity = 1; this.rightLight.intensity = 1;
} }
// this.rightLight.color.b -= 0.05; // this.rightLight.color.b -= 0.05;
this.rightLight.updateInstance('intensity'); this.rightLight.updateInstance('intensity');
// this.rightLight.updateInstance('color'); // this.rightLight.updateInstance('color');
} }
// var smokeParticleEngine = this.smokeParticleEngine.clone(); // var smokeParticleEngine = this.smokeParticleEngine.clone();
// smokeParticleEngine.position = mesh.position.clone(); // smokeParticleEngine.position = mesh.position.clone();
// smokeParticleEngine.updateInstance('position'); // smokeParticleEngine.updateInstance('position');
// smokeParticleEngine.enabled = true; // smokeParticleEngine.enabled = true;
// mesh.smokeParticleEngine = smokeParticleEngine; // mesh.smokeParticleEngine = smokeParticleEngine;
GameLib.Event.Emit( GameLib.Event.Emit(
GameLib.Event.PLAY_AUDIO, GameLib.Event.PLAY_AUDIO,
{ {
name : 'Audio - Burning' name : 'Audio - Burning'
} }
); );
var burningTreeParticleEngine = this.burningTreeParticleEngine.clone(); var burningTreeParticleEngine = this.burningTreeParticleEngine.clone();
burningTreeParticleEngine.position = mesh.position.clone(); burningTreeParticleEngine.position = mesh.position.clone();
burningTreeParticleEngine.position.y += mesh.dimensions.y + 5; burningTreeParticleEngine.position.y += mesh.dimensions.y + 5;
burningTreeParticleEngine.updateInstance('position'); burningTreeParticleEngine.updateInstance('position');
burningTreeParticleEngine.enabled = true; burningTreeParticleEngine.enabled = true;
mesh.burningTreeParticleEngine = burningTreeParticleEngine; mesh.burningTreeParticleEngine = burningTreeParticleEngine;
} }
} }
this.spawnEnemy(); this.spawnEnemy();
} }
this.totalTime += data.delta; this.totalTime += data.delta;
@ -453,34 +453,34 @@ this.scene.meshes.map(
if (this.mouseIsDown) { if (this.mouseIsDown) {
this.kanisterTime += data.delta; this.kanisterTime += data.delta;
if (this.kanisterTime > this.kanisterLife) { if (this.kanisterTime > this.kanisterLife) {
this.fuelFinished = true; this.fuelFinished = true;
} }
if (!this.fuelFinished) { if (!this.fuelFinished) {
/** /**
* Light up the scene * Light up the scene
*/ */
//this.fog.color.r += 0.01; //this.fog.color.r += 0.01;
//if (this.fog.color.r > 0.5) { //if (this.fog.color.r > 0.5) {
// this.fog.color.r = 0.5; // this.fog.color.r = 0.5;
//} //}
//this.fog.updateInstance('color'); //this.fog.updateInstance('color');
this.renderer.clearColor.r += 0.01; this.renderer.clearColor.r += 0.01;
if (this.renderer.clearColor.r > 0.45) { if (this.renderer.clearColor.r > 0.45) {
this.renderer.clearColor.r = 0.45; this.renderer.clearColor.r = 0.45;
} }
this.renderer.updateInstance('clearColor'); 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;
} }
this.throwerLight.updateInstance('instensity'); this.throwerLight.updateInstance('instensity');
} }
var intersects = this.raycaster.getIntersectedObjects(this.scene.meshes); var intersects = this.raycaster.getIntersectedObjects(this.scene.meshes);
intersects.map( intersects.map(
@ -488,40 +488,40 @@ if (this.mouseIsDown) {
var mesh = intersect.mesh; var mesh = intersect.mesh;
if (mesh.name.indexOf('Kanister') !== -1) { if (mesh.name.indexOf('Kanister') !== -1) {
this.explodeKanister(); this.explodeKanister();
return; return;
} }
if (this.fuelFinished) { if (this.fuelFinished) {
GameLib.Event.Emit(GameLib.Event.MOUSE_UP); GameLib.Event.Emit(GameLib.Event.MOUSE_UP);
return; return;
} }
if ( if (
mesh.name.indexOf('Tree - Medium') !== -1 || //tree medium mesh.name.indexOf('Tree - Medium') !== -1 || //tree medium
mesh.name.indexOf('Hamburger') !== -1 || //burger mesh.name.indexOf('Hamburger') !== -1 || //burger
mesh.name.indexOf('Star Cookie') !== -1 || //cookie mesh.name.indexOf('Star Cookie') !== -1 || //cookie
mesh.name.indexOf('Parcel') !== -1 || //parcel mesh.name.indexOf('Parcel') !== -1 || //parcel
mesh.name.indexOf('Bull') !== -1|| //bull mesh.name.indexOf('Bull') !== -1|| //bull
mesh.name.indexOf('Tree - Large') !== -1 || //tree large mesh.name.indexOf('Tree - Large') !== -1 || //tree large
mesh.name.indexOf('Santa') !== -1 || //santa mesh.name.indexOf('Santa') !== -1 || //santa
mesh.name.indexOf('Tree - Small') !== -1 //tree small mesh.name.indexOf('Tree - Small') !== -1 //tree small
) { ) {
if (mesh.materials[0].name.indexOf('Trees') === -1) { if (mesh.materials[0].name.indexOf('Trees') === -1) {
mesh.instance.material.color.sub(this.toBlack); mesh.instance.material.color.sub(this.toBlack);
mesh.materials[0].color.r = mesh.instance.material.color.r; mesh.materials[0].color.r = mesh.instance.material.color.r;
mesh.materials[0].color.g = mesh.instance.material.color.g; mesh.materials[0].color.g = mesh.instance.material.color.g;
mesh.materials[0].color.b = mesh.instance.material.color.b; mesh.materials[0].color.b = mesh.instance.material.color.b;
mesh.materials[0].color.instance = mesh.instance.material.color; mesh.materials[0].color.instance = mesh.instance.material.color;
if (mesh.instance.material.color.r <= 0) { if (mesh.instance.material.color.r <= 0) {
this.burn(mesh); this.burn(mesh);
if (mesh.instance.material.emissive) { if (mesh.instance.material.emissive) {
mesh.instance.material.emissive.add(this.toRed); mesh.instance.material.emissive.add(this.toRed);
@ -533,23 +533,23 @@ if (this.mouseIsDown) {
} }
} }
} else { } else {
/** /**
* This happens to trees * This happens to trees
*/ */
if (GameLib.Utils.UndefinedOrNull(mesh.life)) { if (GameLib.Utils.UndefinedOrNull(mesh.life)) {
mesh.life = 1.2; mesh.life = 1.2;
} }
mesh.life -= 0.2; mesh.life -= 0.2;
// Don't do the color instance // Don't do the color instance
//mesh.materials[0].color.instance = mesh.instance.material.color; //mesh.materials[0].color.instance = mesh.instance.material.color;
if (mesh.life <= 0) { if (mesh.life <= 0) {
this.burnTree(mesh); this.burnTree(mesh);
if (mesh.instance.material.emissive) { if (mesh.instance.material.emissive) {
mesh.instance.material.emissive.add(this.toRed); mesh.instance.material.emissive.add(this.toRed);
mesh.instance.material.emissive.add(this.toRed); mesh.instance.material.emissive.add(this.toRed);
@ -557,9 +557,9 @@ if (this.mouseIsDown) {
// this.explode(mesh); // this.explode(mesh);
//} //}
} }
} }
} }
} }
}.bind(this) }.bind(this)
); );
@ -572,14 +572,14 @@ if (this.mouseIsDown) {
} }
this.renderer.updateInstance('clearColor'); this.renderer.updateInstance('clearColor');
// this.fog.color.r -= 0.01; // this.fog.color.r -= 0.01;
// if (this.fog.color.r < 0.32) { // if (this.fog.color.r < 0.32) {
// this.fog.color.r = 0.32; // this.fog.color.r = 0.32;
// } // }
// this.fog.updateInstance('color'); // this.fog.updateInstance('color');
this.throwerLight.intensity -= 0.05; this.throwerLight.intensity -= 0.05;
if (this.throwerLight.intensity < 0) { if (this.throwerLight.intensity < 0) {
this.throwerLight.intensity = 0; this.throwerLight.intensity = 0;
} }
this.throwerLight.updateInstance('instensity'); this.throwerLight.updateInstance('instensity');
@ -592,38 +592,38 @@ if (this.spawnTime > this.spawnInterval) {
if (this.kanister.explodeParticleEngine) { if (this.kanister.explodeParticleEngine) {
if (GameLib.Utils.UndefinedOrNull(this.kanister.waiting)) { if (GameLib.Utils.UndefinedOrNull(this.kanister.waiting)) {
this.kanister.waiting = true; this.kanister.waiting = true;
} else { } else {
this.kanister.explodeParticleEngine.remove(); this.kanister.explodeParticleEngine.remove();
this.kanister.explodeParticleEngine = null; this.kanister.explodeParticleEngine = null;
delete this.kanister.waiting; delete this.kanister.waiting;
} }
} }
if (this.kanisterTime > (this.kanisterLife / 2)) { if (this.kanisterTime > (this.kanisterLife / 2)) {
this.kanister.visible = true; this.kanister.visible = true;
this.kanister.updateInstance('visible'); this.kanister.updateInstance('visible');
} }
this.enemies = this.enemies.reduce( this.enemies = this.enemies.reduce(
function(result, enemy) { function(result, enemy) {
if (enemy.exploding === true) { if (enemy.exploding === true) {
/** /**
* We need to wait one render cycle for the smoke explode particle engine * We need to wait one render cycle for the smoke explode particle engine
* and then kill the enemy * and then kill the enemy
*/ */
if (GameLib.Utils.UndefinedOrNull(enemy.waiting)) { if (GameLib.Utils.UndefinedOrNull(enemy.waiting)) {
enemy.waiting = true; enemy.waiting = true;
result.push(enemy); result.push(enemy);
} else { } else {
this.kill(enemy); this.kill(enemy);
} }
return result; return result;
} }
enemy.mesh.position.add(enemy.velocity); enemy.mesh.position.add(enemy.velocity);
enemy.mesh.updateInstancePosition(); enemy.mesh.updateInstancePosition();
@ -633,49 +633,48 @@ this.enemies = this.enemies.reduce(
enemy.lifeTime += data.delta; enemy.lifeTime += data.delta;
if (enemy.lifeTime > enemy.life) { if (enemy.lifeTime > enemy.life) {
if (!enemy.burning && !enemy.exploding) { if (!enemy.burning && !enemy.exploding) {
this.lives--; this.lives--;
console.log('lives left: ' + this.lives); console.log('lives left: ' + this.lives);
if (this.lives < 0) { if (this.lives < 0) {
GameLib.Event.Emit(GameLib.Event.GAME_OVER); GameLib.Event.Emit(GameLib.Event.GAME_OVER);
} }
} }
/** /**
* We only remove the things we cloned * We only remove the things we cloned
*/ */
this.kill(enemy); this.kill(enemy);
return result; return result;
} else { } else {
if (enemy.burning) { if (enemy.burning) {
enemy.burnTime += data.delta; enemy.burnTime += data.delta;
if (enemy.burnTime > enemy.burnLife) { if (enemy.burnTime > enemy.burnLife) {
enemy.mesh.smokeParticleEngine.remove(); enemy.mesh.smokeParticleEngine.remove();
enemy.mesh.fireParticleEngine.remove(); enemy.mesh.fireParticleEngine.remove();
enemy.lifeTime = enemy.life + 1; enemy.lifeTime = enemy.life + 1;
enemy.burning = false; } else {
} else { enemy.mesh.smokeParticleEngine.position = enemy.mesh.position.clone();
enemy.mesh.smokeParticleEngine.position = enemy.mesh.position.clone(); enemy.mesh.smokeParticleEngine.updateInstance('position');
enemy.mesh.smokeParticleEngine.updateInstance('position'); enemy.mesh.fireParticleEngine.position = enemy.mesh.position.clone();
enemy.mesh.fireParticleEngine.position = enemy.mesh.position.clone(); enemy.mesh.fireParticleEngine.updateInstance('position');
enemy.mesh.fireParticleEngine.updateInstance('position'); }
}
enemy.mesh.materials[0].opacity -= 0.005; enemy.mesh.materials[0].opacity -= 0.005;
enemy.mesh.materials[0].updateInstance('opacity'); enemy.mesh.materials[0].updateInstance('opacity');
} }
result.push(enemy); result.push(enemy);
return result; return result;
} }
}.bind(this), }.bind(this),