Skip to content

Commit

Permalink
5.1.0 - if entering a new gamestate causes another game state switch,…
Browse files Browse the repository at this point in the history
… do the switch!
  • Loading branch information
BenMakesGames committed Aug 18, 2024
1 parent 60a59e6 commit 4f22ed0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<Company>Ben Hendel-Doying</Company>
<Description>An opinionated framework for making smallish games with MonoGame.</Description>
<Copyright>2021-2024 Ben Hendel-Doying</Copyright>
<Version>5.0.0</Version>
<Version>5.1.0</Version>

<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageTags>monogame game engine framework di state</PackageTags>
Expand Down
14 changes: 7 additions & 7 deletions BenMakesGames.PlayPlayMini/GameStateManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 4f22ed0

Please sign in to comment.