public void RecordCommand(IReplayCommand command) { while (commandHistory.Count > counter) { commandHistory.RemoveAt(counter); } commandBuffer.Enqueue(command); commandHistory.Add(command); }
void init(string name) { this.name = name; commandBuffer = new Queue <IReplayCommand>(); commandHistory = new List <IReplayCommand>(); ReplaySystem.FrameHandler += delegate(object a, EventArgs e) { if (commandBuffer.Count > 0) { IReplayCommand command = commandBuffer.Dequeue(); command.Record(); commandHistory.Add(command); counter++; } }; }