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
|
|
@ -37,7 +37,7 @@ function (Parent, DomController, Settings, NotificationCenter) {
|
|||
var x = (((e.clientX - this.offsetLeft) / Settings.STAGE_WIDTH) * 2) - 1;
|
||||
var y = (((Settings.STAGE_HEIGHT - (e.clientY - this.offsetTop)) / Settings.STAGE_HEIGHT) * 2) -1;
|
||||
|
||||
NotificationCenter.trigger("input/onHandAction", x, y);
|
||||
NotificationCenter.trigger("input/onHandActionRequest", x, y);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ function (Parent, KeyboardInput, MouseInput, NotificationCenter) {
|
|||
this.xyInput = new MouseInput(this);
|
||||
|
||||
NotificationCenter.on("input/onXyChange", this.setXY, this);
|
||||
NotificationCenter.on("input/onHandAction", this.handAction, this);
|
||||
NotificationCenter.on("input/onHandActionRequest", this.handActionRequest, this);
|
||||
|
||||
var keys = {
|
||||
w:87,
|
||||
|
|
@ -75,12 +75,10 @@ function (Parent, KeyboardInput, MouseInput, NotificationCenter) {
|
|||
NotificationCenter.trigger('sendGameCommand', 'lookAt', options);
|
||||
};
|
||||
|
||||
PlayerController.prototype.handAction = function(x, y) {
|
||||
PlayerController.prototype.handActionRequest = function(x, y) {
|
||||
var options = {x:x, y:y};
|
||||
Parent.prototype.handAction.call(this, options);
|
||||
NotificationCenter.trigger("sendGameCommand", "handAction", options);
|
||||
};
|
||||
|
||||
NotificationCenter.trigger("sendGameCommand", "handActionRequest", options);
|
||||
};
|
||||
|
||||
return PlayerController;
|
||||
});
|
||||
|
|
@ -93,6 +93,21 @@ function (Parent, Box2D, PhysicsEngine, ViewManager, PlayerController, Notificat
|
|||
this.gameObjects.animated.push(player.getDoll());
|
||||
}
|
||||
|
||||
GameController.prototype.onHandActionResponse = function(options) {
|
||||
var player = this.players[options.playerId];
|
||||
|
||||
var item = null;
|
||||
for (var i = 0; i < this.gameObjects.animated.length; i++) {
|
||||
var currentItem = this.gameObjects.animated[i];
|
||||
if(currentItem.uid == options.itemUid) {
|
||||
item = currentItem;
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
player.handAction(options.x, options.y, options.isHolding, item);
|
||||
};
|
||||
|
||||
GameController.prototype.loadLevel = function (path) {
|
||||
Parent.prototype.loadLevel.call(this, path);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ define([
|
|||
|
||||
function (Parent, Settings, NotificationCenter, Exception) {
|
||||
|
||||
function Doll(physicsEngine, playerId) {
|
||||
function Doll(physicsEngine, uid, player) {
|
||||
this.animationDef = {
|
||||
"stand": [1,1],
|
||||
"walk": [2,28],
|
||||
|
|
@ -23,7 +23,7 @@ function (Parent, Settings, NotificationCenter, Exception) {
|
|||
this.animatedMeshes = {};
|
||||
this.headMesh = null;
|
||||
|
||||
Parent.call(this, physicsEngine, playerId);
|
||||
Parent.call(this, physicsEngine, uid, player);
|
||||
}
|
||||
|
||||
Doll.prototype = Object.create(Parent.prototype);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue