diff --git a/src/Ecs/Lockstep.ts b/src/Ecs/Lockstep.ts index 71e42fa..26e6950 100644 --- a/src/Ecs/Lockstep.ts +++ b/src/Ecs/Lockstep.ts @@ -80,6 +80,24 @@ export class LockstepState { } } +export class Playback { + private frame = 0; + + public constructor( + private state: State, + private inputLog: Input[], + private engine: LockstepProcessor, + ) {} + + public getNextState(): State { + if(this.frame < this.inputLog.length) { + this.engine.advanceState(this.state, this.inputLog[this.frame]); + this.frame++; + } + return this.state; + } +} + export class LockstepLoop> { }