mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
implemented rube doll to appear when dying
This commit is contained in:
parent
cd956b8a28
commit
2dea240a4b
5 changed files with 99 additions and 14 deletions
|
|
@ -1,11 +1,45 @@
|
|||
define([
|
||||
"Game/Core/GameObjects/Items/RubeDoll"
|
||||
"Game/Core/GameObjects/Items/RubeDoll",
|
||||
"Game/Config/Settings",
|
||||
"Lib/Utilities/NotificationCenter"
|
||||
],
|
||||
|
||||
function (Parent) {
|
||||
function (Parent, Settings, Nc) {
|
||||
|
||||
"use strict";
|
||||
"use strict";
|
||||
|
||||
function RubeDoll(physicsEngine, uid, options) {
|
||||
Parent.call(this, physicsEngine, uid, options);
|
||||
}
|
||||
|
||||
return Parent;
|
||||
RubeDoll.prototype = Object.create(Parent.prototype);
|
||||
|
||||
RubeDoll.prototype.beingReleased = function(player) {
|
||||
Parent.prototype.beingReleased.call(this, player);
|
||||
if(this.scheduledForDestruction) {
|
||||
this.delayedDestroy();
|
||||
}
|
||||
};
|
||||
|
||||
RubeDoll.prototype.delayedDestroy = function() {
|
||||
var self = this;
|
||||
this.scheduledForDestruction = true;
|
||||
this.destructionTimeout = setTimeout(function() {
|
||||
Nc.trigger(Nc.ns.channel.to.client.gameCommand.broadcast, 'removeGameObject', {
|
||||
type: 'animated',
|
||||
uid: self.uid
|
||||
});
|
||||
self.destroy();
|
||||
}, Settings.RAGDOLL_DESTRUCTION_TIME * 1000);
|
||||
};
|
||||
|
||||
RubeDoll.prototype.destroy = function() {
|
||||
if(this.scheduledForDestruction) {
|
||||
clearTimeout(this.destructionTimeout);
|
||||
}
|
||||
Parent.prototype.destroy.call(this);
|
||||
};
|
||||
|
||||
return RubeDoll;
|
||||
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue