public void ClientUpdate(float secondsElapsed) { GameObjectField.SetModeSimulation(); this.SubclassUpdate(secondsElapsed); this.SimulationStateOnlyUpdate(secondsElapsed); GameObjectField.SetModePrevious(); this.SubclassUpdate(secondsElapsed); GameObjectField.SetModeSimulation(); this.Smooth(secondsElapsed); }
public virtual void LatencyAdjustment(GameTime gameTime, long messageTimeStamp) { this.secondsUntilUpdateMessage = this.SecondsBetweenUpdateMessage; this.lastMessageTimeStamp = messageTimeStamp; TimeSpan deltaSpan = new TimeSpan(gameTime.TotalGameTime.Ticks - this.lastMessageTimeStamp); averageLatency.AddValue((float)(deltaSpan.TotalSeconds)); float timeDeviation = (float)(deltaSpan.TotalSeconds) - averageLatency.AverageValue; if (timeDeviation > 0) { GameObjectField.SetModeSimulation(); this.SubclassUpdate(timeDeviation); this.SimulationStateOnlyUpdate(timeDeviation); this.Smooth(timeDeviation); } }