-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathplayerUser.js
32 lines (28 loc) · 975 Bytes
/
playerUser.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
var Player = require('./player.js');
PlayerUser = function(options, socket) {
Player.call(this, options);
this.socket = socket;
}
PlayerUser.prototype = Object.create(Player);
PlayerUser.prototype.constructor = PlayerUser;
PlayerUser.prototype.getGrabMove = function(callback) {
// handle selecting buildings
this.socket.on('grab move', function (move_data) {
console.log('received grab move', move_data);
callback(this, move_data);
}.bind(this));
};
PlayerUser.prototype.getReinforcementMove = function(count, callback) {
this.socket.on('reinforcement move', function(move_data) {
debugger;
console.log('received reinforcement move', move_data);
callback(this, move_data);
}.bind(this));
};
PlayerUser.prototype.getOrdersMove = function(callback) {
this.socket.on('orders move', function (move_data) {
console.log('received orders move', move_data);
callback(this, move_data);
}.bind(this));
};
module.exports = PlayerUser;