mirror of
https://github.com/wassname/GarageServer.IO.git
synced 2026-07-28 11:15:16 +08:00
Cleanup/refactor for #3
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
exports = module.exports = EntityController;
|
||||
|
||||
function EntityController () {
|
||||
}
|
||||
|
||||
EntityController.prototype = {
|
||||
};
|
||||
@@ -0,0 +1,10 @@
|
||||
var EntityController = require('./entitycontroller'),
|
||||
Player = require('../entities/player');
|
||||
|
||||
exports = module.exports = PlayerController;
|
||||
|
||||
function PlayerController () {
|
||||
EntityController.call(this);
|
||||
}
|
||||
|
||||
PlayerController.prototype = Object.create(EntityController.prototype);
|
||||
@@ -0,0 +1,8 @@
|
||||
exports = module.exports = Entity;
|
||||
|
||||
function Entity () {
|
||||
}
|
||||
|
||||
Entity.prototype = {
|
||||
|
||||
};
|
||||
@@ -0,0 +1,9 @@
|
||||
var Entity = require('./entity');
|
||||
|
||||
exports = module.exports = Player;
|
||||
|
||||
function Player () {
|
||||
Entity.call(this);
|
||||
}
|
||||
|
||||
Player.prototype = Object.create(Entity.prototype);
|
||||
@@ -1,4 +1,4 @@
|
||||
var garageServerGame = require('./garageservergame');
|
||||
var GarageServerGame = require('./garageservergame');
|
||||
|
||||
/*
|
||||
options = {
|
||||
@@ -20,7 +20,7 @@ options = {
|
||||
|
||||
function GarageServer (socketio, options) {
|
||||
this.io = socketio;
|
||||
this.game = new garageServerGame.createGame(options);
|
||||
this.game = new GarageServerGame(options);
|
||||
this.registerSocketEvents(options);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
var PlayerController = require('./controllers/playercontroller');
|
||||
|
||||
exports = module.exports = GarageServerGame;
|
||||
|
||||
function GarageServerGame(options) {
|
||||
var self = this;
|
||||
|
||||
@@ -100,8 +104,4 @@ GarageServerGame.prototype.addPlayerInput = function (client, input) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
exports.createGame = function (options){
|
||||
return new GarageServerGame(options);
|
||||
};
|
||||
Reference in New Issue
Block a user