예제 #1
0
        public void ClientUpdate(float secondsElapsed)
        {
            GameObjectField.SetModeSimulation();
            this.SubclassUpdate(secondsElapsed);
            this.SimulationStateOnlyUpdate(secondsElapsed);

            GameObjectField.SetModePrevious();
            this.SubclassUpdate(secondsElapsed);

            GameObjectField.SetModeSimulation();
            this.Smooth(secondsElapsed);
        }
예제 #2
0
        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);
            }
        }