mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
Bugfixing - unsubscribing game related topics, to prevent double calls and leaking references, added offAll method to nc. fixes no rendering bug
This commit is contained in:
parent
40e396fc23
commit
39f684315b
8 changed files with 57 additions and 19 deletions
|
|
@ -43,5 +43,9 @@ define(function () {
|
|||
}
|
||||
}
|
||||
|
||||
PlayerController.prototype.destroy = function() {
|
||||
// extend if necessary
|
||||
};
|
||||
|
||||
return PlayerController;
|
||||
});
|
||||
|
|
@ -17,7 +17,9 @@ function (Settings, Box2D, CollisionDetector, Nc) {
|
|||
this.lastStep = Date.now();
|
||||
this.worldQueue = [];
|
||||
|
||||
Nc.on(Nc.ns.channel.engine.worldQueue.add, this.addToWorldQueue, this);
|
||||
this.ncTokens = [
|
||||
Nc.on(Nc.ns.channel.engine.worldQueue.add, this.addToWorldQueue, this)
|
||||
];
|
||||
}
|
||||
|
||||
Engine.prototype.getWorld = function () {
|
||||
|
|
@ -62,6 +64,7 @@ function (Settings, Box2D, CollisionDetector, Nc) {
|
|||
|
||||
Engine.prototype.destroy = function() {
|
||||
delete this.world;
|
||||
Nc.offAll(this.ncTokens);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -146,6 +146,8 @@ function (Doll, Settings, Nc, Exception, SpectatorDoll, RagDoll) {
|
|||
|
||||
this.spectatorDoll.destroy();
|
||||
if(this.doll) this.doll.destroy();
|
||||
|
||||
this.playerController.destroy();
|
||||
}
|
||||
|
||||
Player.prototype.setPlayerController = function(playerController) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue