mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
This commit is contained in:
parent
039213cf50
commit
55256ada95
23 changed files with 409 additions and 110 deletions
|
|
@ -30,15 +30,21 @@ function (Parent, Settings, Nc) {
|
|||
};
|
||||
|
||||
RagDoll.prototype.delayedDestroy = function() {
|
||||
var self = this;
|
||||
this.scheduledForDestruction = true;
|
||||
this.destructionTimeout = setTimeout(this.destroy.bind(this), Settings.RAGDOLL_DESTRUCTION_TIME * 1000);
|
||||
this.destructionTimeout = setTimeout(function() {
|
||||
Nc.trigger(Nc.ns.channel.to.client.gameCommand.broadcast, 'removeGameObject', {
|
||||
type: 'animated',
|
||||
uid: self.uid
|
||||
});
|
||||
self.destroy.bind(self);
|
||||
}, Settings.RAGDOLL_DESTRUCTION_TIME * 1000);
|
||||
};
|
||||
|
||||
RagDoll.prototype.destroy = function() {
|
||||
Nc.trigger(Nc.ns.channel.to.client.gameCommand.broadcast, 'removeGameObject', {
|
||||
type: 'animated',
|
||||
uid: this.uid
|
||||
});
|
||||
if(this.scheduledForDestruction) {
|
||||
clearTimeout(this.destructionTimeout);
|
||||
}
|
||||
Parent.prototype.destroy.call(this);
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue