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.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.canister = this.entityLoaded.canister;
|
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;
|
||||||
|
@ -42,8 +42,9 @@ if (GameLib.Utils.UndefinedOrNull(this.initialized)) {
|
||||||
*/
|
*/
|
||||||
this.totalTime = 0;
|
this.totalTime = 0;
|
||||||
this.spawnTime = 0;
|
this.spawnTime = 0;
|
||||||
this.canisterTime = 0;
|
this.kanisterTime = 0;
|
||||||
this.canisterLife = 16344;
|
this.kanisterLife = 16344;
|
||||||
|
this.fuelFinished = false;
|
||||||
|
|
||||||
this.enemies = [];
|
this.enemies = [];
|
||||||
|
|
||||||
|
@ -184,13 +185,11 @@ if (GameLib.Utils.UndefinedOrNull(this.initialized)) {
|
||||||
this.enemies.push(enemy);
|
this.enemies.push(enemy);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.explode = function(mesh) {
|
this.explodeMesh = function(mesh) {
|
||||||
|
|
||||||
this.enemies.map(
|
mesh.visible = false;
|
||||||
function(enemy) {
|
|
||||||
if (enemy.mesh === mesh && !enemy.exploding) {
|
mesh.updateInstance('visible');
|
||||||
console.log('exploding enemy');
|
|
||||||
enemy.exploding = true;
|
|
||||||
|
|
||||||
var sound = GameLib.Utils.GetRandomIntInclusive(1,3);
|
var sound = GameLib.Utils.GetRandomIntInclusive(1,3);
|
||||||
|
|
||||||
|
@ -239,11 +238,28 @@ if (GameLib.Utils.UndefinedOrNull(this.initialized)) {
|
||||||
explodeParticleEngine.updateInstance('position');
|
explodeParticleEngine.updateInstance('position');
|
||||||
explodeParticleEngine.enabled = true;
|
explodeParticleEngine.enabled = true;
|
||||||
enemy.explodeParticleEngine = explodeParticleEngine;
|
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)
|
}.bind(this)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
this.explodeKanister = function() {
|
||||||
|
this.kanisterTime = 0;
|
||||||
|
this.explodeMesh(this.kanister);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.burn = function(mesh) {
|
this.burn = function(mesh) {
|
||||||
|
@ -392,6 +408,16 @@ this.scene.meshes.map(
|
||||||
|
|
||||||
if (this.mouseIsDown) {
|
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;
|
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;
|
||||||
|
@ -409,6 +435,7 @@ if (this.mouseIsDown) {
|
||||||
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(
|
||||||
|
@ -416,6 +443,11 @@ if (this.mouseIsDown) {
|
||||||
|
|
||||||
var mesh = intersect.mesh;
|
var mesh = intersect.mesh;
|
||||||
|
|
||||||
|
if (mesh.name.indexOf('Kanister') !== -1) {
|
||||||
|
this.explodeKanister();
|
||||||
|
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
|
||||||
|
@ -509,6 +541,11 @@ if (this.spawnTime > this.nextSpawnTime) {
|
||||||
this.spawnEnemy();
|
this.spawnEnemy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.kanisterTime > (this.kanisterLife / 2)) {
|
||||||
|
this.kanister.visible = true;
|
||||||
|
this.kanister.updateInstance('visible');
|
||||||
|
}
|
||||||
|
|
||||||
this.enemies = this.enemies.reduce(
|
this.enemies = this.enemies.reduce(
|
||||||
function(result, enemy) {
|
function(result, enemy) {
|
||||||
|
|
||||||
|
@ -519,8 +556,6 @@ this.enemies = this.enemies.reduce(
|
||||||
*/
|
*/
|
||||||
if (GameLib.Utils.UndefinedOrNull(enemy.waiting)) {
|
if (GameLib.Utils.UndefinedOrNull(enemy.waiting)) {
|
||||||
enemy.waiting = true;
|
enemy.waiting = true;
|
||||||
enemy.mesh.visible = false;
|
|
||||||
enemy.mesh.updateInstance('visible');
|
|
||||||
result.push(enemy);
|
result.push(enemy);
|
||||||
} else {
|
} else {
|
||||||
this.kill(enemy);
|
this.kill(enemy);
|
||||||
|
|
Loading…
Reference in New Issue