From a8e61875874847be7846c44b15b105131e8cd60b Mon Sep 17 00:00:00 2001 From: -=yb4f310 Date: Tue, 14 Nov 2017 13:15:04 +0100 Subject: [PATCH] Update: CC - Before Render - Moorcow (72d6a2a3kc.js) 288 bytes modified --- 72d6a2a3kc.js | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/72d6a2a3kc.js b/72d6a2a3kc.js index d03ff25..efbce7d 100644 --- a/72d6a2a3kc.js +++ b/72d6a2a3kc.js @@ -15,9 +15,12 @@ if (GameLib.Utils.UndefinedOrNull(this.initialized)) { this.renderer = this.entityLoaded.renderer; this.raycaster = this.entityLoaded.raycaster; this.scene = this.entityLoaded.scene; + this.smokeParticleEngine = this.entityLoaded.smokeParticleEngine; + this.toBlack = new THREE.Color(0.05, 0.05, 0.05); this.toRed = new THREE.Color(0.02, 0, 0); - + + this.bull.instance.visible = false; this.star.instance.visible = false; this.burger.instance.visible = false; @@ -160,8 +163,15 @@ if (GameLib.Utils.UndefinedOrNull(this.initialized)) { enemy.lifeTime = 0; enemy.life = 15; + enemy.exploding = false; + this.enemies.push(enemy); } + + this.explode = function(mesh) { + var particleEngine = this.smokeParticleEngine.clone(); + particleEngine.position = mesh.position.clone(); + } } this.totalTime += data.delta; @@ -214,14 +224,18 @@ if (this.mouseIsDown) { ) { if (mesh.materials[0].name.indexOf('Trees') === -1) { + mesh.instance.material.color.sub(this.toBlack); + + if (mesh.instance.material.color.r + if (mesh.instance.material.color.r <= 0) { if (mesh.instance.material.emissive) { mesh.instance.material.emissive.add(this.toRed); mesh.instance.material.emissive.add(this.toRed); - if (mesh.instance.material.emissive.r >= 1.0) { - console.log('!explode!' + mesh.name); + if (mesh.instance.material.emissive.r >= 0.8) { + this.explode(mesh); } } }