()
| 145 | } |
| 146 | |
| 147 | private async next(): Promise<boolean> { |
| 148 | if (this.previousScene) { |
| 149 | await this.previousScene.next(); |
| 150 | if (this.currentScene.isFinished()) { |
| 151 | this.previousScene = null; |
| 152 | } |
| 153 | } |
| 154 | |
| 155 | this.frame += this.speed; |
| 156 | |
| 157 | if (this.currentScene.isFinished()) { |
| 158 | return true; |
| 159 | } |
| 160 | |
| 161 | await this.currentScene.next(); |
| 162 | if (this.previousScene && this.currentScene.isAfterTransitionIn()) { |
| 163 | this.previousScene = null; |
| 164 | } |
| 165 | |
| 166 | if (this.currentScene.canTransitionOut()) { |
| 167 | this.previousScene = this.currentScene; |
| 168 | const nextScene = this.getNextScene(this.previousScene); |
| 169 | if (nextScene) { |
| 170 | this.previousScene.stopAllMedia(); |
| 171 | this.currentScene = nextScene; |
| 172 | await this.currentScene.reset(this.previousScene); |
| 173 | } |
| 174 | if (!nextScene || this.currentScene.isAfterTransitionIn()) { |
| 175 | this.previousScene = null; |
| 176 | } |
| 177 | } |
| 178 | |
| 179 | return this.currentScene.isFinished(); |
| 180 | } |
| 181 | |
| 182 | private findBestScene(frame: number): Scene { |
| 183 | let lastScene = this.scenes.current[0]; |
no test coverage detected