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

            timeStamps.AddFirst(timeStamp);
        }
Exemplo 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;
            }
        }
Exemplo 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");
        }
Exemplo n.º 4
0
 public void AddFirstBefore(TimeStamp timeStamp, int time)
 {
     this.BatchPop(time);
     Push(timeStamp);
 }
Exemplo n.º 5
0
        public void SwapFirstTimeStamp(TimeStamp timeStamp)
        {
            if(timeStamps.Count > 0)
            {
                TimeStamp returnStamp = timeStamps.First.Value;
                timeStamps.RemoveFirst();

            }

            timeStamps.AddFirst(timeStamp);
        }