Update: CC - Before Render - Moorcow (zo950m57cc.js) 8652 bytes modified
parent
5b84693ba7
commit
34526b795c
169
zo950m57cc.js
169
zo950m57cc.js
|
@ -1,8 +1,8 @@
|
|||
if (!this.entityLoaded) {
|
||||
if (!this.entityLoaded) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(this.initialized)) {
|
||||
if (GameLib.Utils.UndefinedOrNull(this.initialized)) {
|
||||
|
||||
this.initialized = true;
|
||||
|
||||
|
@ -61,15 +61,8 @@ if (GameLib.Utils.UndefinedOrNull(this.initialized)) {
|
|||
|
||||
this.minimumRendererRed = 0.1;
|
||||
|
||||
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;
|
||||
this.parcel.instance.visible = false;
|
||||
this.santa.instance.visible = false;
|
||||
this.kanister.instance.visible = false;
|
||||
this.toBlack = new THREE.Color(data.delta, data.delta, data.delta);
|
||||
this.toRed = new THREE.Color(data.delta, 0, 0);
|
||||
|
||||
this.treesBurning = 0;
|
||||
this.treesBurningToStart = GameLib.Utils.GetRandomIntInclusive(1, 3);
|
||||
|
@ -238,9 +231,7 @@ if (GameLib.Utils.UndefinedOrNull(this.initialized)) {
|
|||
null
|
||||
);
|
||||
|
||||
if (meshType == 1) {
|
||||
|
||||
}
|
||||
return mesh;
|
||||
}
|
||||
|
||||
this.spawnEnemy = function(kanister) {
|
||||
|
@ -251,6 +242,14 @@ if (GameLib.Utils.UndefinedOrNull(this.initialized)) {
|
|||
if (kanister) {
|
||||
meshType = 6;
|
||||
} else {
|
||||
|
||||
var mesh = this.getNextMesh(meshType);
|
||||
|
||||
if (!mesh) {
|
||||
console.warn('re-attempt to spawn');
|
||||
return this.spawnEnemy(false);
|
||||
}
|
||||
|
||||
this.enemiesSpawned++;
|
||||
this.setLevelProperties();
|
||||
}
|
||||
|
@ -259,51 +258,33 @@ if (GameLib.Utils.UndefinedOrNull(this.initialized)) {
|
|||
|
||||
var speed = 1;
|
||||
|
||||
var score = 10;
|
||||
var score = 0;
|
||||
|
||||
var material = null;
|
||||
var mesh = this.getNextMesh(meshType);
|
||||
|
||||
var mesh = null;
|
||||
if (meshType === 1) {
|
||||
mesh = this.bull.clone();
|
||||
material = this.bull.materials[0].clone();
|
||||
score = 10;
|
||||
speed = 0.3;
|
||||
} else if (meshType === 2) {
|
||||
mesh = this.star.clone();
|
||||
score = 20;
|
||||
material = this.star.materials[0].clone();
|
||||
speed = 0.4;
|
||||
} else if (meshType === 3) {
|
||||
mesh = this.burger.clone();
|
||||
score = 50;
|
||||
material = this.burger.materials[0].clone();
|
||||
speed = 0.45;
|
||||
} else if (meshType === 4) {
|
||||
mesh = this.parcel.clone();
|
||||
score = 75;
|
||||
material = this.parcel.materials[0].clone();
|
||||
speed = 0.5;
|
||||
} else if (meshType === 5) {
|
||||
mesh = this.santa.clone();
|
||||
score = 100;
|
||||
material = this.santa.materials[0].clone();
|
||||
speed = 0.6;
|
||||
} else if (meshType === 6) {
|
||||
mesh = this.kanister.clone();
|
||||
score = 100;
|
||||
material = this.kanister.materials[0].clone();
|
||||
score = 0;
|
||||
speed = 0.7;
|
||||
}
|
||||
else {
|
||||
console.log('unknown mesh type : ' + meshType);
|
||||
}
|
||||
|
||||
mesh.materials = [material];
|
||||
|
||||
mesh.updateInstance();
|
||||
|
||||
mesh.instance.visible = true;
|
||||
|
||||
var velocity = null;
|
||||
|
||||
var axis = new GameLib.API.Vector3(
|
||||
|
@ -449,11 +430,12 @@ if (GameLib.Utils.UndefinedOrNull(this.initialized)) {
|
|||
}
|
||||
);
|
||||
|
||||
var explodeParticleEngine = this.explodeParticleEngine.clone();
|
||||
explodeParticleEngine.position = mesh.position.clone();
|
||||
mesh.explodeParticleEngine.position.x = mesh.position.x;
|
||||
mesh.explodeParticleEngine.position.y = mesh.position.y;
|
||||
mesh.explodeParticleEngine.position.z = mesh.position.z;
|
||||
explodeParticleEngine.updateInstance('position');
|
||||
explodeParticleEngine.enabled = true;
|
||||
mesh.explodeParticleEngine = explodeParticleEngine;
|
||||
|
||||
mesh.explodeParticleEngine.enabled = true;
|
||||
|
||||
};
|
||||
|
||||
|
@ -555,11 +537,17 @@ if (GameLib.Utils.UndefinedOrNull(this.initialized)) {
|
|||
}
|
||||
);
|
||||
|
||||
var smokeParticleEngine = this.smokeParticleEngine.clone();
|
||||
smokeParticleEngine.position = mesh.position.clone();
|
||||
smokeParticleEngine.updateInstance('position');
|
||||
smokeParticleEngine.enabled = true;
|
||||
mesh.smokeParticleEngine = smokeParticleEngine;
|
||||
mesh.smokeParticleEngine.position.x = mesh.position.x;
|
||||
mesh.smokeParticleEngine.position.y = mesh.position.y;
|
||||
mesh.smokeParticleEngine.position.z = mesh.position.z;
|
||||
mesh.smokeParticleEngine.updateInstance('position');
|
||||
mesh.smokeParticleEngine.enabled = true;
|
||||
|
||||
mesh.fireParticleEngine.position.x = mesh.position.x;
|
||||
mesh.fireParticleEngine.position.y = mesh.position.y;
|
||||
mesh.fireParticleEngine.position.z = mesh.position.z;
|
||||
mesh.fireParticleEngine.updateInstance('position');
|
||||
mesh.fireParticleEngine.enabled = true;
|
||||
|
||||
GameLib.Event.Emit(
|
||||
GameLib.Event.PLAY_AUDIO,
|
||||
|
@ -567,12 +555,6 @@ if (GameLib.Utils.UndefinedOrNull(this.initialized)) {
|
|||
name : 'Audio - Burning'
|
||||
}
|
||||
);
|
||||
|
||||
var fireParticleEngine = this.fireParticleEngine.clone();
|
||||
fireParticleEngine.position = mesh.position.clone();
|
||||
fireParticleEngine.updateInstance('position');
|
||||
fireParticleEngine.enabled = true;
|
||||
mesh.fireParticleEngine = fireParticleEngine;
|
||||
}
|
||||
}.bind(this)
|
||||
);
|
||||
|
@ -582,7 +564,6 @@ if (GameLib.Utils.UndefinedOrNull(this.initialized)) {
|
|||
|
||||
this.kill = function(enemy) {
|
||||
|
||||
if (!enemy.isKanister) {
|
||||
this.meshes[enemy.meshType].map(
|
||||
function(object) {
|
||||
if (object.mesh === enemy.mesh) {
|
||||
|
@ -592,12 +573,12 @@ if (GameLib.Utils.UndefinedOrNull(this.initialized)) {
|
|||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* We only remove the things we cloned
|
||||
*/
|
||||
/*
|
||||
GameLib.Event.Emit(
|
||||
/*
|
||||
GameLib.Event.Emit(
|
||||
GameLib.Event.REMOVE_COMPONENT,
|
||||
{
|
||||
component : enemy.mesh.materials[0]
|
||||
|
@ -610,7 +591,7 @@ GameLib.Event.Emit(
|
|||
component : enemy.mesh
|
||||
}
|
||||
);
|
||||
*/
|
||||
*/
|
||||
/**
|
||||
* Also dispose of the THREE.js objects
|
||||
*/
|
||||
|
@ -618,18 +599,15 @@ GameLib.Event.Emit(
|
|||
//enemy.mesh.instance.material.dispose();
|
||||
|
||||
if (enemy.mesh.smokeParticleEngine) {
|
||||
enemy.mesh.smokeParticleEngine.remove();
|
||||
enemy.mesh.smokeParticleEngine = null;
|
||||
enemy.mesh.smokeParticleEngine.enabled = false;
|
||||
}
|
||||
|
||||
if (enemy.mesh.fireParticleEngine) {
|
||||
enemy.mesh.fireParticleEngine.remove();
|
||||
enemy.mesh.fireParticleEngine = null;
|
||||
enemy.mesh.fireParticleEngine.enabled = false;
|
||||
}
|
||||
|
||||
if (enemy.mesh.explodeParticleEngine) {
|
||||
enemy.mesh.explodeParticleEngine.remove();
|
||||
enemy.mesh.explodeParticleEngine = null;
|
||||
enemy.mesh.explodeParticleEngine.enabled = false;
|
||||
}
|
||||
|
||||
};
|
||||
|
@ -719,18 +697,18 @@ GameLib.Event.Emit(
|
|||
game : this
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
this.totalTime += data.delta;
|
||||
this.enemySpawnTime += data.delta;
|
||||
this.totalTime += data.delta;
|
||||
this.enemySpawnTime += data.delta;
|
||||
|
||||
this.scoreMesh.materials[0].opacity -= data.delta * 0.5;
|
||||
if (this.scoreMesh.materials[0].opacity < 0) {
|
||||
this.scoreMesh.materials[0].opacity -= data.delta * 0.5;
|
||||
if (this.scoreMesh.materials[0].opacity < 0) {
|
||||
this.scoreMesh.materials[0].opacity = 0;
|
||||
}
|
||||
this.scoreMesh.materials[0].updateInstance('opacity');
|
||||
}
|
||||
this.scoreMesh.materials[0].updateInstance('opacity');
|
||||
|
||||
this.scene.meshes.map(
|
||||
this.scene.meshes.map(
|
||||
function(mesh) {
|
||||
if (mesh.instance.material instanceof Array) {
|
||||
mesh.instance.material.map(
|
||||
|
@ -746,10 +724,10 @@ this.scene.meshes.map(
|
|||
}
|
||||
}
|
||||
}.bind(this)
|
||||
);
|
||||
);
|
||||
|
||||
if (this.mouseIsDown)
|
||||
{
|
||||
if (this.mouseIsDown)
|
||||
{
|
||||
this.kanisterTime += data.delta;
|
||||
|
||||
this.renderer.clearColor.r += 0.01;
|
||||
|
@ -838,9 +816,9 @@ if (this.mouseIsDown)
|
|||
}.bind(this)
|
||||
);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
this.kanisterTime += (data.delta * this.kanisterLeakTime);
|
||||
|
||||
this.renderer.clearColor.r -= 0.01;
|
||||
|
@ -854,11 +832,11 @@ else
|
|||
this.throwerLight.intensity = 0;
|
||||
}
|
||||
this.throwerLight.updateInstance('intensity');
|
||||
}
|
||||
}
|
||||
|
||||
var used = this.kanisterTime / this.kanisterLife;
|
||||
var used = this.kanisterTime / this.kanisterLife;
|
||||
|
||||
GameLib.Event.Emit(
|
||||
GameLib.Event.Emit(
|
||||
GameLib.Event.GAME_DATA,
|
||||
{
|
||||
event : 'fuelUsed',
|
||||
|
@ -866,9 +844,9 @@ GameLib.Event.Emit(
|
|||
percentage : Math.round(used * 100) + '%',
|
||||
kanisters : this.kanisters
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
if (this.kanisterTime > this.kanisterLife) {
|
||||
if (this.kanisterTime > this.kanisterLife) {
|
||||
|
||||
this.kanisterTime = 0;
|
||||
this.kanisters -= 1;
|
||||
|
@ -889,12 +867,12 @@ if (this.kanisterTime > this.kanisterLife) {
|
|||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.enemySpawnTime > this.enemySpawnInterval && this.running) {
|
||||
if (this.enemySpawnTime > this.enemySpawnInterval && this.running) {
|
||||
this.enemySpawnTime = 0;
|
||||
this.spawnEnemy();
|
||||
}
|
||||
}
|
||||
//
|
||||
|
||||
// if (this.kanister.explodeParticleEngine) {
|
||||
|
@ -920,7 +898,7 @@ if (this.enemySpawnTime > this.enemySpawnInterval && this.running) {
|
|||
// );
|
||||
// }
|
||||
|
||||
this.enemies = this.enemies.reduce(
|
||||
this.enemies = this.enemies.reduce(
|
||||
function(result, enemy) {
|
||||
|
||||
if (enemy.exploding === true) {
|
||||
|
@ -970,17 +948,22 @@ this.enemies = this.enemies.reduce(
|
|||
enemy.burnTime += data.delta;
|
||||
|
||||
if (enemy.burnTime > enemy.burnLife) {
|
||||
enemy.mesh.smokeParticleEngine.remove();
|
||||
enemy.mesh.fireParticleEngine.remove();
|
||||
enemy.mesh.smokeParticleEngine.enabled = false;
|
||||
enemy.mesh.fireParticleEngine.enabled = false;
|
||||
enemy.lifeTime = enemy.life + 1;
|
||||
} else {
|
||||
enemy.mesh.smokeParticleEngine.position = enemy.mesh.position.clone();
|
||||
enemy.mesh.smokeParticleEngine.position.x = enemy.mesh.position.x;
|
||||
enemy.mesh.smokeParticleEngine.position.y = enemy.mesh.position.y;
|
||||
enemy.mesh.smokeParticleEngine.position.z = enemy.mesh.position.z;
|
||||
enemy.mesh.smokeParticleEngine.updateInstance('position');
|
||||
enemy.mesh.fireParticleEngine.position = enemy.mesh.position.clone();
|
||||
|
||||
enemy.mesh.fireParticleEngine.position.x = enemy.mesh.position.x;
|
||||
enemy.mesh.fireParticleEngine.position.y = enemy.mesh.position.y;
|
||||
enemy.mesh.fireParticleEngine.position.z = enemy.mesh.position.z;
|
||||
enemy.mesh.fireParticleEngine.updateInstance('position');
|
||||
}
|
||||
|
||||
enemy.mesh.materials[0].opacity -= 0.005;
|
||||
enemy.mesh.materials[0].opacity -= 0.05 * data.delta;
|
||||
enemy.mesh.materials[0].updateInstance('opacity');
|
||||
|
||||
}
|
||||
|
@ -991,7 +974,7 @@ this.enemies = this.enemies.reduce(
|
|||
|
||||
}.bind(this),
|
||||
[]
|
||||
);
|
||||
);
|
||||
|
||||
return null;
|
||||
return null;
|
||||
//# sourceURL=beforeRender.js
|
Loading…
Reference in New Issue