void Update() { if (isActivationValid()) { if (beforeNextScene != null) { this.enabled = false; // avoid re execution of the before next scene effect beforeNextScene.setScene(LevelManager.Instance.getNextLevelEnum()); beforeNextScene.execute(); } else { LevelManager.Instance.loadNextLevel(); } } }
private void doAction() { if (PauseGameManager.Instance.isPaused()) { return; } this.enabled = false; // avoid repetead execution when on touching if (beforeNextScene != null) { beforeNextScene.execute(); } else { LevelManager.Instance.loadLevel(targetScene); } }