Update: CC - Before Render - Moorcow (a2ow5l92js.js) 6028 bytes modified
parent
8d8b6315cc
commit
e6db2003f9
|
@ -1,8 +1,8 @@
|
||||||
if (!this.entityLoaded) {
|
if (!this.entityLoaded) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(this.initialized)) {
|
if (GameLib.Utils.UndefinedOrNull(this.initialized)) {
|
||||||
|
|
||||||
this.initialized = true;
|
this.initialized = true;
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@
|
||||||
this.santa.instance.visible = false;
|
this.santa.instance.visible = false;
|
||||||
|
|
||||||
this.treesBurning = 0;
|
this.treesBurning = 0;
|
||||||
this.treesBurningToStart = GameLib.Utils.GetRandomIntInclusive(1, 3)
|
this.treesBurningToStart = GameLib.Utils.GetRandomIntInclusive(1, 3);
|
||||||
|
|
||||||
this.running = false;
|
this.running = false;
|
||||||
|
|
||||||
|
@ -46,15 +46,21 @@
|
||||||
* This component is initializing - set the total time to 0
|
* This component is initializing - set the total time to 0
|
||||||
*/
|
*/
|
||||||
this.totalTime = 0;
|
this.totalTime = 0;
|
||||||
this.spawnTime = 0;
|
|
||||||
|
this.kanisters = 4;
|
||||||
this.kanisterTime = 0;
|
this.kanisterTime = 0;
|
||||||
this.kanisterLife = 16.344;
|
this.kanisterLife = 16.344;
|
||||||
|
this.kanisterLeakTime = 0.001;
|
||||||
|
this.kanisterSpawnInterval = 50;
|
||||||
|
|
||||||
this.fuelFinished = false;
|
this.fuelFinished = false;
|
||||||
|
|
||||||
this.level = 1;
|
this.level = 1;
|
||||||
this.spawnInterval = 5;
|
|
||||||
|
this.enemySpawnInterval = 5;
|
||||||
|
this.enemySpawnTime = this.enemySpawnInterval;
|
||||||
|
|
||||||
this.score = 0;
|
this.score = 0;
|
||||||
this.lives = 10;
|
|
||||||
|
|
||||||
if (this.enemies instanceof Array && this.enemies.length !== 0) {
|
if (this.enemies instanceof Array && this.enemies.length !== 0) {
|
||||||
this.enemies.map(
|
this.enemies.map(
|
||||||
|
@ -73,7 +79,7 @@
|
||||||
mesh.burningTreeParticleEngine = null;
|
mesh.burningTreeParticleEngine = null;
|
||||||
}
|
}
|
||||||
}.bind(this)
|
}.bind(this)
|
||||||
)
|
);
|
||||||
|
|
||||||
this.enemies = [];
|
this.enemies = [];
|
||||||
|
|
||||||
|
@ -86,13 +92,6 @@
|
||||||
this.rightLight.intensity = 0.3;
|
this.rightLight.intensity = 0.3;
|
||||||
this.rightLight.updateInstance('intensity');
|
this.rightLight.updateInstance('intensity');
|
||||||
|
|
||||||
GameLib.Event.Emit(
|
|
||||||
GameLib.Event.GAME_STARTED,
|
|
||||||
{
|
|
||||||
game : this
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
GameLib.Event.Emit(
|
GameLib.Event.Emit(
|
||||||
GameLib.Event.GET_GRAPHICS_IMPLEMENTATION,
|
GameLib.Event.GET_GRAPHICS_IMPLEMENTATION,
|
||||||
null,
|
null,
|
||||||
|
@ -115,26 +114,26 @@
|
||||||
amount = 0.1;
|
amount = 0.1;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.spawnInterval -= amount;
|
this.enemySpawnInterval -= amount;
|
||||||
|
|
||||||
console.log('level : ' + this.level +', spawn interval : ' + this.spawnInterval);
|
console.log('level : ' + this.level +', spawn interval : ' + this.enemySpawnInterval);
|
||||||
|
|
||||||
GameLib.Event.Emit(
|
GameLib.Event.Emit(
|
||||||
GameLib.Event.GAME_DATA,
|
GameLib.Event.GAME_DATA,
|
||||||
{
|
{
|
||||||
level : this.level,
|
level : this.level,
|
||||||
spawnInterval : this.spawnInterval,
|
enemySpawnInterval : this.enemySpawnInterval,
|
||||||
event : 'levelIncrease'
|
event : 'levelIncrease'
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
this.spawnEnemy = function() {
|
this.spawnEnemy = function() {
|
||||||
|
|
||||||
this.enemiesSpawned++;
|
this.enemiesSpawned++;
|
||||||
|
|
||||||
this.setLevelProperties();
|
//this.setLevelProperties();
|
||||||
|
|
||||||
var enemyType = GameLib.Utils.GetRandomIntInclusive(1, 5);
|
var enemyType = GameLib.Utils.GetRandomIntInclusive(1, 5);
|
||||||
var meshType = GameLib.Utils.GetRandomIntInclusive(1, 5);
|
var meshType = GameLib.Utils.GetRandomIntInclusive(1, 5);
|
||||||
|
@ -269,7 +268,7 @@
|
||||||
);
|
);
|
||||||
|
|
||||||
this.enemies.push(enemy);
|
this.enemies.push(enemy);
|
||||||
}
|
};
|
||||||
|
|
||||||
this.explodeMesh = function(mesh) {
|
this.explodeMesh = function(mesh) {
|
||||||
|
|
||||||
|
@ -359,13 +358,13 @@
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
this.explodeKanister = function() {
|
this.explodeKanister = function() {
|
||||||
this.kanisterTime = 0;
|
this.kanisterTime = 0;
|
||||||
this.fuelFinished = false;
|
this.fuelFinished = false;
|
||||||
this.explodeMesh(this.kanister);
|
this.explodeMesh(this.kanister);
|
||||||
}
|
};
|
||||||
|
|
||||||
this.burn = function(mesh) {
|
this.burn = function(mesh) {
|
||||||
|
|
||||||
|
@ -408,7 +407,7 @@
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
this.kill = function(enemy) {
|
this.kill = function(enemy) {
|
||||||
/**
|
/**
|
||||||
|
@ -528,15 +527,20 @@
|
||||||
burningTreeParticleEngine.enabled = true;
|
burningTreeParticleEngine.enabled = true;
|
||||||
mesh.burningTreeParticleEngine = burningTreeParticleEngine;
|
mesh.burningTreeParticleEngine = burningTreeParticleEngine;
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
GameLib.Event.Emit(
|
||||||
|
GameLib.Event.GAME_STARTED,
|
||||||
|
{
|
||||||
|
game : this
|
||||||
}
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
this.spawnEnemy();
|
this.totalTime += data.delta;
|
||||||
}
|
this.enemySpawnTime += data.delta;
|
||||||
|
|
||||||
this.totalTime += data.delta;
|
this.scene.meshes.map(
|
||||||
this.spawnTime += data.delta;
|
|
||||||
|
|
||||||
this.scene.meshes.map(
|
|
||||||
function(mesh) {
|
function(mesh) {
|
||||||
if (mesh.instance.material instanceof Array) {
|
if (mesh.instance.material instanceof Array) {
|
||||||
mesh.instance.material.map(
|
mesh.instance.material.map(
|
||||||
|
@ -552,9 +556,9 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.bind(this)
|
}.bind(this)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (this.mouseIsDown) {
|
if (this.mouseIsDown) {
|
||||||
|
|
||||||
this.kanisterTime += data.delta;
|
this.kanisterTime += data.delta;
|
||||||
|
|
||||||
|
@ -567,7 +571,6 @@
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
if (this.kanisterTime > this.kanisterLife) {
|
if (this.kanisterTime > this.kanisterLife) {
|
||||||
this.fuelFinished = true;
|
this.fuelFinished = true;
|
||||||
|
|
||||||
|
@ -669,7 +672,7 @@
|
||||||
}.bind(this)
|
}.bind(this)
|
||||||
);
|
);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
this.renderer.clearColor.r -= 0.01;
|
this.renderer.clearColor.r -= 0.01;
|
||||||
if (this.renderer.clearColor.r < this.minimumRendererRed) {
|
if (this.renderer.clearColor.r < this.minimumRendererRed) {
|
||||||
|
@ -682,14 +685,14 @@
|
||||||
this.throwerLight.intensity = 0;
|
this.throwerLight.intensity = 0;
|
||||||
}
|
}
|
||||||
this.throwerLight.updateInstance('intensity');
|
this.throwerLight.updateInstance('intensity');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.spawnTime > this.spawnInterval && this.running) {
|
if (this.enemySpawnTime > this.enemySpawnInterval && this.running) {
|
||||||
this.spawnTime = 0;
|
this.enemySpawnTime = 0;
|
||||||
this.spawnEnemy();
|
this.spawnEnemy();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.kanister.explodeParticleEngine) {
|
if (this.kanister.explodeParticleEngine) {
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(this.kanister.waiting)) {
|
if (GameLib.Utils.UndefinedOrNull(this.kanister.waiting)) {
|
||||||
this.kanister.waiting = true;
|
this.kanister.waiting = true;
|
||||||
|
@ -699,9 +702,9 @@
|
||||||
delete this.kanister.waiting;
|
delete this.kanister.waiting;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.kanisterTime > (this.kanisterLife / 2)) {
|
if (this.kanisterTime > (this.kanisterLife / 2)) {
|
||||||
this.kanister.visible = true;
|
this.kanister.visible = true;
|
||||||
this.kanister.updateInstance('visible');
|
this.kanister.updateInstance('visible');
|
||||||
|
|
||||||
|
@ -711,9 +714,9 @@
|
||||||
event : 'kanisterAppeared'
|
event : 'kanisterAppeared'
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.enemies = this.enemies.reduce(
|
this.enemies = this.enemies.reduce(
|
||||||
function(result, enemy) {
|
function(result, enemy) {
|
||||||
|
|
||||||
if (enemy.exploding === true) {
|
if (enemy.exploding === true) {
|
||||||
|
@ -812,7 +815,7 @@
|
||||||
|
|
||||||
}.bind(this),
|
}.bind(this),
|
||||||
[]
|
[]
|
||||||
);
|
);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
//# sourceURL=beforeRender.js
|
//# sourceURL=beforeRender.js
|
Loading…
Reference in New Issue