diff --git a/app/Game/Channel/Channel.js b/app/Game/Channel/Channel.js index 5f39b08..094cef0 100755 --- a/app/Game/Channel/Channel.js +++ b/app/Game/Channel/Channel.js @@ -62,7 +62,7 @@ levelUid: this.getNextLevelUid() }; - console.log(gameControllerOptions) + console.checkpoint("Begin Round (" + this.name + ")"); this.gameController = new GameController(gameControllerOptions); @@ -80,6 +80,8 @@ Channel.prototype.onEndRound = function() { var self = this; this.broadcastControlCommand("endRound", true); + + console.checkpoint("End Round (" + this.name + ") - Begin Round in " + Settings.CHANNEL_END_ROUND_TIME + " seconds"); setTimeout(function() { self.beginRound(); diff --git a/app/Game/Client/GameObjects/Items/RagDoll.js b/app/Game/Client/GameObjects/Items/RagDoll.js index f89c72b..1541e2b 100644 --- a/app/Game/Client/GameObjects/Items/RagDoll.js +++ b/app/Game/Client/GameObjects/Items/RagDoll.js @@ -99,9 +99,7 @@ function (Parent, CoreItem, Settings, Nc) { }; RagDoll.prototype.destroy = function() { - - console.log('ragdoll destroy'); - + for (var name in this.limbMeshes) { Nc.trigger(Nc.ns.client.view.mesh.remove, this.limbMeshes[name]); }; diff --git a/app/Game/Core/GameController.js b/app/Game/Core/GameController.js index c83c1ca..1e00239 100755 --- a/app/Game/Core/GameController.js +++ b/app/Game/Core/GameController.js @@ -66,30 +66,6 @@ function (PhysicsEngine, TiledLevel, Player, Nc) { this.loadLevel(this.level.uid); }; - GameController.prototype.destroy = function () { - for(var player in this.players) { - // this.players[player].destroy(); - - // FIXME: - // commented out for now, because players are in gameObjects array. - // try using a real gameobject for the health bar - } - - for (var i = 0; i < this.ncTokens.length; i++) { - Nc.off(this.ncTokens[i]); - }; - - for (var key in this.gameObjects) { - for (var i = 0; i < this.gameObjects[key].length; i++) { - var gameObject = this.gameObjects[key][i]; - this.onGameObjectRemove(key, gameObject); - gameObject.destroy(); - }; - }; - - this.physicsEngine.destroy(); - } - /* GameController.prototype.userJoined = function (user) { this.players[user.id] = this.createPlayer(user); @@ -116,5 +92,29 @@ function (PhysicsEngine, TiledLevel, Player, Nc) { return player; }; + GameController.prototype.destroy = function () { + for(var player in this.players) { + // this.players[player].destroy(); + + // FIXME: + // commented out for now, because players are in gameObjects array. + // try using a real gameobject for the health bar + } + + for (var i = 0; i < this.ncTokens.length; i++) { + Nc.off(this.ncTokens[i]); + }; + + for (var key in this.gameObjects) { + for (var i = 0; i < this.gameObjects[key].length; i++) { + var gameObject = this.gameObjects[key][i]; + this.onGameObjectRemove(key, gameObject); + gameObject.destroy(); + }; + }; + + this.physicsEngine.destroy(); + } + return GameController; }); diff --git a/app/Game/Core/GameObjects/Items/RagDoll.js b/app/Game/Core/GameObjects/Items/RagDoll.js index 03130e3..8b6f751 100644 --- a/app/Game/Core/GameObjects/Items/RagDoll.js +++ b/app/Game/Core/GameObjects/Items/RagDoll.js @@ -362,13 +362,15 @@ function (Parent, Box2D, Settings, Nc) { }; RagDoll.prototype.destroy = function() { + Nc.trigger(Nc.ns.core.game.gameObject.remove, 'animated', this); var world = this.body.GetWorld(); - Parent.prototype.destroy.call(this); for (var name in this.limbs) { world.DestroyBody(this.limbs[name]); } + + Parent.prototype.destroy.call(this); }; return RagDoll;