Update: CC - Before Render - Moorcow (7p8dxknb7m.js) 1651 bytes modified
parent
479a9748c8
commit
81c8f8f4dd
|
@ -215,6 +215,31 @@ if (GameLib.Utils.UndefinedOrNull(this.initialized)) {
|
|||
);
|
||||
|
||||
|
||||
}
|
||||
|
||||
this.burnTree = function(mesh) {
|
||||
|
||||
if (mesh.userData.burning) {
|
||||
/**
|
||||
* Do nothing, this tree is burning
|
||||
*/
|
||||
} else {
|
||||
mesh.userData.burning = true;
|
||||
|
||||
var smokeParticleEngine = this.smokeParticleEngine.clone();
|
||||
smokeParticleEngine.position = mesh.position.clone();
|
||||
smokeParticleEngine.updateInstance('position');
|
||||
smokeParticleEngine.enabled = true;
|
||||
|
||||
mesh.userData.smokeParticleEngine = smokeParticleEngine;
|
||||
|
||||
var fireParticleEngine = this.fireParticleEngine.clone();
|
||||
fireParticleEngine.position = mesh.position.clone();
|
||||
fireParticleEngine.updateInstance('position');
|
||||
fireParticleEngine.enabled = true;
|
||||
mesh.userData.fireParticleEngine = fireParticleEngine;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -290,7 +315,33 @@ if (this.mouseIsDown) {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/**
|
||||
* This happens to trees
|
||||
*/
|
||||
mesh.instance.material.color.sub(this.toBlack);
|
||||
|
||||
mesh.materials[0].color.r = mesh.instance.material.color.r;
|
||||
mesh.materials[0].color.g = mesh.instance.material.color.g;
|
||||
mesh.materials[0].color.b = mesh.instance.material.color.b;
|
||||
|
||||
// Don't do the color instance
|
||||
mesh.materials[0].color.instance = mesh.instance.material.color;
|
||||
|
||||
if (mesh.instance.material.color.r <= 0) {
|
||||
this.burnTree(mesh);
|
||||
|
||||
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 >= 0.8) {
|
||||
// this.explode(mesh);
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}.bind(this)
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue