diff --git a/xtihcyhagp.js b/xtihcyhagp.js index ee6e324..f3e26b4 100644 --- a/xtihcyhagp.js +++ b/xtihcyhagp.js @@ -57,22 +57,21 @@ GameLib.Event.Emit( this.mouse = new GameLib.Mouse(this.graphics); this.raycaster = new GameLib.D3.Raycaster(this.graphics); +this.beforeRender = GameLib.EntityManager.Instance.findComponentById('autqzs1rvq'); +this.mouseUp = GameLib.EntityManager.Instance.findComponentById('monq9ryw7a'); +this.mouseDown = GameLib.EntityManager.Instance.findComponentById('d5o2axpc0m'); +this.mouseMove = GameLib.EntityManager.Instance.findComponentById('6st4io7ceu'); + /** * Tell all our custom code components that we loaded */ GameLib.Event.Subscribe( GameLib.Event.GAME_START, function() { - this.beforeRender = GameLib.EntityManager.Instance.findComponentById('autqzs1rvq'); + this.beforeRender.entityLoaded = this; - - this.mouseUp = GameLib.EntityManager.Instance.findComponentById('monq9ryw7a'); this.mouseUp.entityLoaded = this; - - this.mouseDown = GameLib.EntityManager.Instance.findComponentById('d5o2axpc0m'); - this.mouseDown.entityLoaded = this; - - this.mouseMove = GameLib.EntityManager.Instance.findComponentById('6st4io7ceu'); + this.mouseDown.entityLoaded = this; this.mouseMove.entityLoaded = this; GameLib.Event.Emit(GameLib.Event.WINDOW_RESIZE, {width : window.innerWidth, height:window.innerHeight}); @@ -86,6 +85,24 @@ GameLib.Event.Subscribe( }.bind(this) ); +GameLib.Event.Subscribe( + GameLib.Event.GAME_OVER, + function() { + + this.beforeRender.entityLoaded = null; + this.mouseUp.entityLoaded = null; + this.mouseDown.entityLoaded = null; + this.mouseMove.entityLoaded = null; + + GameLib.Event.Emit( + GameLib.Event.STOP_AUDIO, + { + name : 'Audio - Xmas' + } + ); + }.bind(this) +); + //GameLib.Event.Emit(GameLib.Event.MOUSE_UP);