Update: CC - Before Render - Moorcow (a2ow5l92js.js) 6028 bytes modified

beta.r3js.org
-=yb4f310 2017-11-24 13:15:11 +01:00
parent 8d8b6315cc
commit e6db2003f9
1 changed files with 668 additions and 665 deletions

View File

@ -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,13 +527,18 @@
burningTreeParticleEngine.enabled = true; burningTreeParticleEngine.enabled = true;
mesh.burningTreeParticleEngine = burningTreeParticleEngine; mesh.burningTreeParticleEngine = burningTreeParticleEngine;
} }
} };
this.spawnEnemy(); GameLib.Event.Emit(
GameLib.Event.GAME_STARTED,
{
game : this
}
);
} }
this.totalTime += data.delta; this.totalTime += data.delta;
this.spawnTime += data.delta; this.enemySpawnTime += data.delta;
this.scene.meshes.map( this.scene.meshes.map(
function(mesh) { function(mesh) {
@ -567,7 +571,6 @@
} }
); );
if (this.kanisterTime > this.kanisterLife) { if (this.kanisterTime > this.kanisterLife) {
this.fuelFinished = true; this.fuelFinished = true;
@ -684,8 +687,8 @@
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();
} }