mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
fixed remote joint
This commit is contained in:
parent
0665348ae2
commit
b159bbb1cc
12 changed files with 143 additions and 29 deletions
|
|
@ -1,9 +1,45 @@
|
|||
define([
|
||||
"Game/Core/Player"
|
||||
"Game/Core/Player",
|
||||
"Lib/Utilities/NotificationCenter"
|
||||
],
|
||||
|
||||
function(Parent) {
|
||||
function (Parent, NotificationCenter) {
|
||||
|
||||
function Player(id, physicsEngine) {
|
||||
Parent.call(this, id, physicsEngine);
|
||||
}
|
||||
|
||||
return Parent;
|
||||
Player.prototype = Object.create(Parent.prototype);
|
||||
|
||||
Player.prototype.handActionRequest = function(x, y) {
|
||||
|
||||
var item = null;
|
||||
var isHolding = !!this.holdingItem;
|
||||
|
||||
if (isHolding) {
|
||||
item = this.holdingItem;
|
||||
} else {
|
||||
item = this.doll.findCloseItem(x, y);
|
||||
}
|
||||
|
||||
if(item) {
|
||||
|
||||
this.handAction(x, y, isHolding, item);
|
||||
|
||||
var message = {
|
||||
handActionResponse: {
|
||||
playerId: this.id,
|
||||
isHolding: isHolding,
|
||||
itemUid: item.uid,
|
||||
x: x,
|
||||
y: y
|
||||
}
|
||||
};
|
||||
|
||||
NotificationCenter.trigger("sendControlCommandToAllUsers", "gameCommand", message);
|
||||
}
|
||||
}
|
||||
|
||||
return Player;
|
||||
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue