diff --git a/BenMakesGames.PlayPlayMini/BenMakesGames.PlayPlayMini.csproj b/BenMakesGames.PlayPlayMini/BenMakesGames.PlayPlayMini.csproj index de78752..98df353 100644 --- a/BenMakesGames.PlayPlayMini/BenMakesGames.PlayPlayMini.csproj +++ b/BenMakesGames.PlayPlayMini/BenMakesGames.PlayPlayMini.csproj @@ -5,7 +5,7 @@ Ben Hendel-Doying An opinionated framework for making smallish games with MonoGame. 2021-2024 Ben Hendel-Doying - 5.0.0 + 5.1.0 true monogame game engine framework di state diff --git a/BenMakesGames.PlayPlayMini/GameStateManager.cs b/BenMakesGames.PlayPlayMini/GameStateManager.cs index 8cf54b3..8631d6b 100644 --- a/BenMakesGames.PlayPlayMini/GameStateManager.cs +++ b/BenMakesGames.PlayPlayMini/GameStateManager.cs @@ -154,15 +154,15 @@ protected override void EndDraw() private void SwitchState() { - if(NextState is null) - return; - - CurrentState.Leave(); + while (NextState is not null) + { + CurrentState.Leave(); - CurrentState = NextState; - NextState = null; + CurrentState = NextState; + NextState = null; - CurrentState.Enter(); + CurrentState.Enter(); + } } public void ChangeState(GameState nextState)