class NextLevel { currentState = 0; states: Array = []; constructor(states: Array) { this.states = states; } update() { this.states[this.currentState](); } next() { this.currentState++; } }