mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
console.log, checkpoint and code cleanup
This commit is contained in:
parent
39f684315b
commit
55b56f9c12
4 changed files with 31 additions and 29 deletions
|
|
@ -62,7 +62,7 @@
|
||||||
levelUid: this.getNextLevelUid()
|
levelUid: this.getNextLevelUid()
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log(gameControllerOptions)
|
console.checkpoint("Begin Round (" + this.name + ")");
|
||||||
|
|
||||||
this.gameController = new GameController(gameControllerOptions);
|
this.gameController = new GameController(gameControllerOptions);
|
||||||
|
|
||||||
|
|
@ -81,6 +81,8 @@
|
||||||
var self = this;
|
var self = this;
|
||||||
this.broadcastControlCommand("endRound", true);
|
this.broadcastControlCommand("endRound", true);
|
||||||
|
|
||||||
|
console.checkpoint("End Round (" + this.name + ") - Begin Round in " + Settings.CHANNEL_END_ROUND_TIME + " seconds");
|
||||||
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
self.beginRound();
|
self.beginRound();
|
||||||
}, Settings.CHANNEL_END_ROUND_TIME * 1000);
|
}, Settings.CHANNEL_END_ROUND_TIME * 1000);
|
||||||
|
|
|
||||||
|
|
@ -100,8 +100,6 @@ function (Parent, CoreItem, Settings, Nc) {
|
||||||
|
|
||||||
RagDoll.prototype.destroy = function() {
|
RagDoll.prototype.destroy = function() {
|
||||||
|
|
||||||
console.log('ragdoll destroy');
|
|
||||||
|
|
||||||
for (var name in this.limbMeshes) {
|
for (var name in this.limbMeshes) {
|
||||||
Nc.trigger(Nc.ns.client.view.mesh.remove, this.limbMeshes[name]);
|
Nc.trigger(Nc.ns.client.view.mesh.remove, this.limbMeshes[name]);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -66,30 +66,6 @@ function (PhysicsEngine, TiledLevel, Player, Nc) {
|
||||||
this.loadLevel(this.level.uid);
|
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) {
|
GameController.prototype.userJoined = function (user) {
|
||||||
this.players[user.id] = this.createPlayer(user);
|
this.players[user.id] = this.createPlayer(user);
|
||||||
|
|
@ -116,5 +92,29 @@ function (PhysicsEngine, TiledLevel, Player, Nc) {
|
||||||
return player;
|
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;
|
return GameController;
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -362,13 +362,15 @@ function (Parent, Box2D, Settings, Nc) {
|
||||||
};
|
};
|
||||||
|
|
||||||
RagDoll.prototype.destroy = function() {
|
RagDoll.prototype.destroy = function() {
|
||||||
|
|
||||||
Nc.trigger(Nc.ns.core.game.gameObject.remove, 'animated', this);
|
Nc.trigger(Nc.ns.core.game.gameObject.remove, 'animated', this);
|
||||||
var world = this.body.GetWorld();
|
var world = this.body.GetWorld();
|
||||||
Parent.prototype.destroy.call(this);
|
|
||||||
|
|
||||||
for (var name in this.limbs) {
|
for (var name in this.limbs) {
|
||||||
world.DestroyBody(this.limbs[name]);
|
world.DestroyBody(this.limbs[name]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Parent.prototype.destroy.call(this);
|
||||||
};
|
};
|
||||||
|
|
||||||
return RagDoll;
|
return RagDoll;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue