Renamed state variable to be more consistent with server

This commit is contained in:
Jeremiah Billmann
2013-07-09 21:28:00 -04:00
parent 10e20936db
commit cd0a076424
2 changed files with 6 additions and 6 deletions
+4 -4
View File
@@ -72,13 +72,13 @@ window.GarageServerIO = (function (window, socketio) {
function Entity(id) {
this.updates = [];
this.id = id;
this.currentState = {};
this.state = {};
}
Entity.prototype = {
addUpate: function (state, seq, time) {
var newUpdate = new Update(state, seq, time);
if (this.updates.length === 0) {
this.currentState = newUpdate.state;
this.state = newUpdate.state;
}
this.updates.push(newUpdate);
if (this.updates.length > 120) {
@@ -317,7 +317,7 @@ window.GarageServerIO = (function (window, socketio) {
getEntityStatesCurrent = function (entityController) {
entityController.entities.forEach(function (entity) {
if (entity.anyUpdates()) {
entity.currentState = entity.latestUpdate().state;
entity.state = entity.latestUpdate().state;
}
});
},
@@ -330,7 +330,7 @@ window.GarageServerIO = (function (window, socketio) {
if (positions.previous && positions.target) {
amount = getInterpolatedAmount(positions.previous.time, positions.target.time);
newState = _options.onInterpolation(entity.id, positions.previous.state, positions.target.state, amount);
entity.currentState = newState = _options.onInterpolation(entity.id, entity.currentState, newState, _stateController.smoothingFactor);
entity.state = newState = _options.onInterpolation(entity.id, entity.state, newState, _stateController.smoothingFactor);
}
}
});