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(); }