public void checkPause() { if (Input.getKeyDown(Input.KEY_ESCAPE) && !checkGameOver() && !checkLevelEnded()) { pause = !pause; if (pause) { manager.alert(UIState.PAUSE); } else { manager.alert(UIState.GAME); } } if (manager.getOldState() == UIState.GAME) { pause = manager.isPaused(); } }
@Override public void render(RenderingEngine engine) { engine.render(level); if (pause || gameOver || levelEnded) { engine.render(manager.getMainFrame(), true); } }
public boolean checkLevelEnded() { boolean res = GameplayManager.getInstance().isLevelEnded(); if (res) { manager.alert(UIState.LEVEL_ENDED); } return res; }
public boolean checkGameOver() { boolean res = GameplayManager.getInstance().isGameOver(); if (res) { manager.alert(UIState.GAME_OVER); } return res; }
@Override public void update() { GameplayManager.getInstance().update((Player) Level.getObjects().get(0)); gameOver = checkGameOver(); levelEnded = checkLevelEnded(); checkPause(); if (pause || gameOver || levelEnded) { manager.update(); } else { level.input(); level.update(); ParticleMaster.update(camera); } }