SCCapstone / GreedyGuppyGames

5 stars 1 forks source link

Softlock at end of round #246

Closed Arleycht closed 3 years ago

Arleycht commented 3 years ago

Steps to reproduce:

  1. Play through a stage until round 15
  2. After the last enemy has spawned on the last round (15), click the Play button
  3. ???
  4. Round counter is greater than 15 (Game does not terminate, does not count as win, nothing happens)

I believe the following lines are the direct causes for this, since there are no bound-checks before increment and to determine game state: https://github.com/SCCapstone/GreedyGuppyGames/blob/1106858116ccb8674b8d8cb702d9e1f1fe66d884/Assets/Scripts/WaveSpawner.cs#L86 https://github.com/SCCapstone/GreedyGuppyGames/blob/1106858116ccb8674b8d8cb702d9e1f1fe66d884/Assets/Scripts/WaveSpawner.cs#L99

I might recommend checking the round using inequalities because it is resistant to this.

index >= maxRounds - 1

Example of what happens in-game as a result of this: Round Increment