mirror of
https://github.com/wassname/GarageServer.IO.git
synced 2026-06-27 16:10:34 +08:00
23 lines
599 B
JavaScript
23 lines
599 B
JavaScript
var entity = require('./entity');
|
|
|
|
exports = module.exports = Player;
|
|
|
|
function Player (socket, maxHistorySecondBuffer) {
|
|
entity.call(this, socket.id, maxHistorySecondBuffer);
|
|
this.socket = socket;
|
|
this.inputs = [];
|
|
}
|
|
|
|
Player.prototype = Object.create(entity.prototype);
|
|
|
|
Player.prototype.setRegion = function (region) {
|
|
this.socket.join(region);
|
|
this.socket.leave(this.region);
|
|
this.region = region;
|
|
};
|
|
|
|
Player.prototype.addState = function (state, executionTime) {
|
|
this.addHistory(state, executionTime);
|
|
this.sequence += this.inputs.length;
|
|
this.inputs = [];
|
|
}; |