mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 18:47:35 +00:00
replaced all tabs with 4 spaces
This commit is contained in:
parent
5d11540c55
commit
26f3d22db7
30 changed files with 1017 additions and 1011 deletions
|
|
@ -1,76 +1,76 @@
|
|||
define([
|
||||
"Game/Core/GameController",
|
||||
"Game/Client/Physics/Engine",
|
||||
"Game/Client/View/ViewController",
|
||||
"Game/Client/Control/KeyboardController",
|
||||
"Game/Core/NotificationCenter",
|
||||
"Lib/Utilities/RequestAnimFrame"
|
||||
"Game/Core/GameController",
|
||||
"Game/Client/Physics/Engine",
|
||||
"Game/Client/View/ViewController",
|
||||
"Game/Client/Control/KeyboardController",
|
||||
"Game/Core/NotificationCenter",
|
||||
"Lib/Utilities/RequestAnimFrame"
|
||||
],
|
||||
|
||||
function(Parent, PhysicsEngine, ViewController, KeyboardController, NotificationCenter, requestAnimFrame) {
|
||||
|
||||
function GameController () {
|
||||
this.viewController = new ViewController();
|
||||
function GameController () {
|
||||
this.viewController = new ViewController();
|
||||
|
||||
Parent.call(this, new PhysicsEngine());
|
||||
Parent.call(this, new PhysicsEngine());
|
||||
|
||||
this.me = null;
|
||||
this.keyboardController = null;
|
||||
this.me = null;
|
||||
this.keyboardController = null;
|
||||
|
||||
//NotificationCenter.on('me/joined', this.meJoined, this)
|
||||
//NotificationCenter.on('me/joined', this.meJoined, this)
|
||||
|
||||
//this.update();
|
||||
}
|
||||
//this.update();
|
||||
}
|
||||
|
||||
GameController.prototype = Object.create(Parent.prototype);
|
||||
GameController.prototype = Object.create(Parent.prototype);
|
||||
|
||||
/*
|
||||
GameController.prototype.getMe = function() {
|
||||
return this.me;
|
||||
}
|
||||
GameController.prototype.getMe = function() {
|
||||
return this.me;
|
||||
}
|
||||
|
||||
GameController.prototype.update = function() {
|
||||
GameController.prototype.update = function() {
|
||||
|
||||
requestAnimFrame(this.update.bind(this));
|
||||
requestAnimFrame(this.update.bind(this));
|
||||
|
||||
this.physicsEngine.update();
|
||||
this.viewController.update();
|
||||
this.physicsEngine.update();
|
||||
this.viewController.update();
|
||||
|
||||
if(this.me) {
|
||||
this.keyboardController.update();
|
||||
this.me.update();
|
||||
}
|
||||
}
|
||||
if(this.me) {
|
||||
this.keyboardController.update();
|
||||
this.me.update();
|
||||
}
|
||||
}
|
||||
|
||||
GameController.prototype.meJoined = function(user) {
|
||||
this.me = this.userJoined(user);
|
||||
GameController.prototype.meJoined = function(user) {
|
||||
this.me = this.userJoined(user);
|
||||
|
||||
this.keyboardController = new KeyboardController(this.me, this);
|
||||
}
|
||||
this.keyboardController = new KeyboardController(this.me, this);
|
||||
}
|
||||
|
||||
GameController.prototype.processGameCommand = function(command, options) {
|
||||
|
||||
if (command == "worldUpdate") {
|
||||
GameController.prototype.processGameCommand = function(command, options) {
|
||||
|
||||
if (command == "worldUpdate") {
|
||||
|
||||
var body = this.physicsEngine.world.GetBodyList();
|
||||
do {
|
||||
var userData = body.GetUserData();
|
||||
if(userData && options[userData]) {
|
||||
var update = options[userData];
|
||||
|
||||
//console.log('position difference:', (body.GetPosition().y - update.p.y) * 30, body.GetLinearVelocity().y);
|
||||
|
||||
body.SetAwake(true);
|
||||
body.SetPosition(update.p);
|
||||
body.SetAngle(update.a);
|
||||
body.SetLinearVelocity(update.lv);
|
||||
body.SetAngularVelocity(update.av);
|
||||
}
|
||||
} while (body = body.GetNext());
|
||||
var body = this.physicsEngine.world.GetBodyList();
|
||||
do {
|
||||
var userData = body.GetUserData();
|
||||
if(userData && options[userData]) {
|
||||
var update = options[userData];
|
||||
|
||||
//console.log('position difference:', (body.GetPosition().y - update.p.y) * 30, body.GetLinearVelocity().y);
|
||||
|
||||
body.SetAwake(true);
|
||||
body.SetPosition(update.p);
|
||||
body.SetAngle(update.a);
|
||||
body.SetLinearVelocity(update.lv);
|
||||
body.SetAngularVelocity(update.av);
|
||||
}
|
||||
} while (body = body.GetNext());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
*/
|
||||
return GameController;
|
||||
return GameController;
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue