20 lines
442 B
TypeScript
20 lines
442 B
TypeScript
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
class NextLevel {
|
|
currentState = 0;
|
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
|
states: Array<Function> = [];
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
|
constructor(states: Array<Function>) {
|
|
this.states = states;
|
|
}
|
|
|
|
update() {
|
|
this.states[this.currentState]();
|
|
}
|
|
|
|
next() {
|
|
this.currentState++;
|
|
}
|
|
}
|