Add stub demo-playback code
This commit is contained in:
parent
21886c00a8
commit
14ccebc703
1 changed files with 18 additions and 0 deletions
|
@ -80,6 +80,24 @@ export class LockstepState<Input, State> {
|
|||
}
|
||||
}
|
||||
|
||||
export class Playback<Input, State> {
|
||||
private frame = 0;
|
||||
|
||||
public constructor(
|
||||
private state: State,
|
||||
private inputLog: Input[],
|
||||
private engine: LockstepProcessor<Input, State>,
|
||||
) {}
|
||||
|
||||
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<Input, State extends DeepCopy<State>> {
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue