public void StopState(GameState pGameState) { switch (pGameState) { case GameState.STARTSCREEN: if (_startScreen != null) { _startScreen.Destroy(); _startScreen = null; } break; case GameState.OPENINGSCREEN: if (_openingScreen != null) { _openingScreen.Destroy(); _openingScreen = null; } break; case GameState.LEVEL: if (_level != null) { if (_level.GetHud() != null) { _level.GetHud().Destroy(); } if (_level.GetBackground() != null) { _level.GetBackground().Destroy(); if (_level.GetBackground().GetBackDrop() != null) { _level.GetBackground().GetBackDrop().Destroy(); } if (_level.GetBackground().GetMidGround() != null) { _level.GetBackground().GetMidGround().Destroy(); } } if (_level.GetForeGround() != null) { _level.GetForeGround().Destroy(); } _level.Destroy(); _level = null; } break; case GameState.LOSESCREEN: if (_loseScreen != null) { _loseScreen.Destroy(); _loseScreen = null; } break; case GameState.WINSCREEN: if (_winScreen != null) { _winScreen.Destroy(); _winScreen = null; } break; default: break; } }