Update: CC - Before Render - Moorcow (080g209iov.js) 420 bytes modified
parent
2bcec8d627
commit
138a1bd95c
|
@ -14,7 +14,7 @@ if (GameLib.Utils.UndefinedOrNull(this.initialized)) {
|
|||
this.santa = this.entityLoaded.santa;
|
||||
this.renderer = this.entityLoaded.renderer;
|
||||
this.raycaster = this.entityLoaded.raycaster;
|
||||
this.canister = this.entityLoaded.canister;
|
||||
this.kanister = this.entityLoaded.kanister;
|
||||
this.scene = this.entityLoaded.scene;
|
||||
this.leftLight = this.entityLoaded.leftLight;
|
||||
this.rightLight = this.entityLoaded.rightLight;
|
||||
|
@ -42,8 +42,9 @@ if (GameLib.Utils.UndefinedOrNull(this.initialized)) {
|
|||
*/
|
||||
this.totalTime = 0;
|
||||
this.spawnTime = 0;
|
||||
this.canisterTime = 0;
|
||||
this.canisterLife = 16344;
|
||||
this.kanisterTime = 0;
|
||||
this.kanisterLife = 16344;
|
||||
this.fuelFinished = false;
|
||||
|
||||
this.enemies = [];
|
||||
|
||||
|
@ -184,13 +185,11 @@ if (GameLib.Utils.UndefinedOrNull(this.initialized)) {
|
|||
this.enemies.push(enemy);
|
||||
}
|
||||
|
||||
this.explode = function(mesh) {
|
||||
this.explodeMesh = function(mesh) {
|
||||
|
||||
this.enemies.map(
|
||||
function(enemy) {
|
||||
if (enemy.mesh === mesh && !enemy.exploding) {
|
||||
console.log('exploding enemy');
|
||||
enemy.exploding = true;
|
||||
mesh.visible = false;
|
||||
|
||||
mesh.updateInstance('visible');
|
||||
|
||||
var sound = GameLib.Utils.GetRandomIntInclusive(1,3);
|
||||
|
||||
|
@ -239,11 +238,28 @@ if (GameLib.Utils.UndefinedOrNull(this.initialized)) {
|
|||
explodeParticleEngine.updateInstance('position');
|
||||
explodeParticleEngine.enabled = true;
|
||||
enemy.explodeParticleEngine = explodeParticleEngine;
|
||||
|
||||
};
|
||||
|
||||
this.explode = function(mesh) {
|
||||
|
||||
this.enemies.map(
|
||||
function(enemy) {
|
||||
if (enemy.mesh === mesh && !enemy.exploding) {
|
||||
console.log('exploding enemy');
|
||||
enemy.exploding = true;
|
||||
|
||||
this.explodeMesh(mesh);
|
||||
}
|
||||
}.bind(this)
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
|
||||
this.explodeKanister = function() {
|
||||
this.kanisterTime = 0;
|
||||
this.explodeMesh(this.kanister);
|
||||
}
|
||||
|
||||
this.burn = function(mesh) {
|
||||
|
@ -392,6 +408,16 @@ this.scene.meshes.map(
|
|||
|
||||
if (this.mouseIsDown) {
|
||||
|
||||
this.kanisterTime += data.delta;
|
||||
|
||||
if (this.kanisterTime > this.kanisterLife) {
|
||||
this.fuelFinished = true;
|
||||
}
|
||||
|
||||
if (!this.fuelFinished) {
|
||||
/**
|
||||
* Light up the scene
|
||||
*/
|
||||
this.fog.color.r += 0.01;
|
||||
if (this.fog.color.r > 0.5) {
|
||||
this.fog.color.r = 0.5;
|
||||
|
@ -409,6 +435,7 @@ if (this.mouseIsDown) {
|
|||
this.throwerLight.intensity = 2;
|
||||
}
|
||||
this.throwerLight.updateInstance('instensity');
|
||||
}
|
||||
|
||||
var intersects = this.raycaster.getIntersectedObjects(this.scene.meshes);
|
||||
intersects.map(
|
||||
|
@ -416,6 +443,11 @@ if (this.mouseIsDown) {
|
|||
|
||||
var mesh = intersect.mesh;
|
||||
|
||||
if (mesh.name.indexOf('Kanister') !== -1) {
|
||||
this.explodeKanister();
|
||||
return;
|
||||
}
|
||||
|
||||
if (
|
||||
mesh.name.indexOf('Tree - Medium') !== -1 || //tree medium
|
||||
mesh.name.indexOf('Hamburger') !== -1 || //burger
|
||||
|
@ -509,6 +541,11 @@ if (this.spawnTime > this.nextSpawnTime) {
|
|||
this.spawnEnemy();
|
||||
}
|
||||
|
||||
if (this.kanisterTime > (this.kanisterLife / 2)) {
|
||||
this.kanister.visible = true;
|
||||
this.kanister.updateInstance('visible');
|
||||
}
|
||||
|
||||
this.enemies = this.enemies.reduce(
|
||||
function(result, enemy) {
|
||||
|
||||
|
@ -519,8 +556,6 @@ this.enemies = this.enemies.reduce(
|
|||
*/
|
||||
if (GameLib.Utils.UndefinedOrNull(enemy.waiting)) {
|
||||
enemy.waiting = true;
|
||||
enemy.mesh.visible = false;
|
||||
enemy.mesh.updateInstance('visible');
|
||||
result.push(enemy);
|
||||
} else {
|
||||
this.kill(enemy);
|
||||
|
|
Loading…
Reference in New Issue