Update: CC - Before Render - Moorcow (72d6a2a3kc.js) 288 bytes modified

beta.r3js.org
-=yb4f310 2017-11-14 13:15:04 +01:00
parent f585830035
commit a8e6187587
1 changed files with 17 additions and 3 deletions

View File

@ -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);
}
}
}