Esempio n. 1
0
        public void Push(TimeStamp timeStamp)
        {
            if(timeStamps.Count > max)
            {
                timeStamps.RemoveLast();
            }

            timeStamps.AddFirst(timeStamp);
        }
Esempio n. 2
0
        public void ApplyTimeStamp(TimeStamp timeStamp, TimeSpan totalGameTime, int localID)
        {
            Queue<Command> localCommands = new Queue<Command>(gameStateManager.RollBack(timeStamp.time, localID));
            gameStateManager.TimeStampManager.SwapFirstTimeStamp(timeStamp);

            GameLoop gameLoop = new GameLoop(0);

            SimulationGameTime simulationGameTime = new SimulationGameTime(totalGameTime, totalGameTime.TotalMilliseconds - timeStamp.time);
            gameLoop.InputQueue = localCommands;

            while (simulationGameTime.SimulationTime > 0)
            {
                gameLoop.SimulationLoop(simulationGameTime, this.gameStateManager);
                simulationGameTime.SimulationTime -= 50;
            }
        }
Esempio n. 3
0
        public TimeStamp ReplaceTimeStamp(TimeStamp timeStamp, int time)
        {
            LinkedListNode<TimeStamp> toReplace = FindTimeStamp(time);

            if(toReplace != null)
            {
                timeStamps.AddBefore(toReplace, timeStamp);

                if (timeStamps.Remove(toReplace.Value))
                {
                    return toReplace.Value;
                }
            }

            throw new Exception("Could not replace timestamp");
        }
Esempio n. 4
0
 public void AddFirstBefore(TimeStamp timeStamp, int time)
 {
     this.BatchPop(time);
     Push(timeStamp);
 }
Esempio n. 5
0
        public void SwapFirstTimeStamp(TimeStamp timeStamp)
        {
            if(timeStamps.Count > 0)
            {
                TimeStamp returnStamp = timeStamps.First.Value;
                timeStamps.RemoveFirst();

            }

            timeStamps.AddFirst(timeStamp);
        }