From 8d8b6315cc4e9c40125d20c4d9781547edf5ed2c Mon Sep 17 00:00:00 2001 From: -=yb4f310 Date: Fri, 24 Nov 2017 12:59:37 +0100 Subject: [PATCH] Update: CC - Before Render - Moorcow (a2ow5l92js.js) 494 bytes modified --- a2ow5l92js.js | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/a2ow5l92js.js b/a2ow5l92js.js index a2b5519..096dbaa 100644 --- a/a2ow5l92js.js +++ b/a2ow5l92js.js @@ -38,7 +38,10 @@ this.santa.instance.visible = false; this.treesBurning = 0; + this.treesBurningToStart = GameLib.Utils.GetRandomIntInclusive(1, 3) + this.running = false; + /** * This component is initializing - set the total time to 0 */ @@ -162,7 +165,7 @@ } else if (meshType === 5) { mesh = this.santa.clone(); material = this.santa.materials[0].clone(); - speed = 0.5; + speed = 0.6; } else { console.log('unknown mesh type : ' + meshType); } @@ -460,11 +463,26 @@ this.treesBurning++; + if ( + (this.treesBurning > this.treesBurningToStart) && + !this.running + ) { + this.running = true; + GameLib.Event.Emit( + GameLib.Event.GAME_DATA, + { + event : 'gameRunning', + message : 'we have enough trees burning now to start - the enemy will spawn now' + } + ); + } + GameLib.Event.Emit( GameLib.Event.GAME_DATA, { event : 'treeBurned', - treesBurning : this.treesBurning + treesBurning : this.treesBurning, + treesBurningToStart : this.treesBurningToStart } ); @@ -666,7 +684,7 @@ this.throwerLight.updateInstance('intensity'); } - if (this.spawnTime > this.spawnInterval) { + if (this.spawnTime > this.spawnInterval && this.running) { this.spawnTime = 0; this.spawnEnemy(); }