public void Return() { SceneManager.LoadScene(_previousScene); Persistency.SaveData(Persistency.DataGroups.Sound); // if (instance._previousScene != SceneManager.GetActiveScene().buildIndex) // { // instance._previousScene = SceneManager.GetActiveScene().buildIndex; // } }
void OnTriggerEnter(Collider other) { if (!shine.activeSelf) { shine.SetActive(true); particle.Play(); audio.Play(); Persistency.SetCheckpoint(gameObject); } }
void Awake() { if (instance != null) { Destroy(gameObject); return; } DontDestroyOnLoad(gameObject); instance = this; checkpointLevel = Application.loadedLevel; checkpointStatue = GameObject.Find("Checkpoint"); }
public void GameOver() { // if game has ended, check for new highscores to be saved and load the Game Over Scene _gameOver = true; if (_score > _highScore) { _highScore = _score; Persistency.SaveData(Persistency.DataGroups.Score); _newRecord = true; } StartCoroutine(WaitForPlayerDeathEffects()); }
public Persistent(Persistency persistency) { Persistency = persistency; }
private void Start() { Persistency.LoadSavedData(Persistency.DataGroups.Sound); }
void OnDeath() { Persistency.OnDeath(); Destroy(gameObject); }
private void ChooseCanvas() { // enable the appropriate canvas based on Scene type, or hide them all if the Scene type is not recognized switch (SceneController.instance.currentSceneType) { case SceneController.SceneTypes.Start: { _startScreenCanvas.SetActive(true); _instructionsScreenCanvas.SetActive(false); _optionsScreenCanvas.SetActive(false); _creditsScreenCanvas.SetActive(false); _levelScreenCanvas.SetActive(false); _gameOverScreenCanvas.SetActive(false); _pauseMenuCanvas.SetActive(false); break; } case SceneController.SceneTypes.Instructions: { _startScreenCanvas.SetActive(false); _instructionsScreenCanvas.SetActive(true); _optionsScreenCanvas.SetActive(false); _creditsScreenCanvas.SetActive(false); _levelScreenCanvas.SetActive(false); _gameOverScreenCanvas.SetActive(false); _pauseMenuCanvas.SetActive(false); break; } case SceneController.SceneTypes.Options: { _startScreenCanvas.SetActive(false); _instructionsScreenCanvas.SetActive(false); _optionsScreenCanvas.SetActive(true); _creditsScreenCanvas.SetActive(false); _levelScreenCanvas.SetActive(false); _gameOverScreenCanvas.SetActive(false); _pauseMenuCanvas.SetActive(false); break; } case SceneController.SceneTypes.Credits: { _startScreenCanvas.SetActive(false); _instructionsScreenCanvas.SetActive(false); _optionsScreenCanvas.SetActive(false); _creditsScreenCanvas.SetActive(true); _levelScreenCanvas.SetActive(false); _gameOverScreenCanvas.SetActive(false); _pauseMenuCanvas.SetActive(false); break; } case SceneController.SceneTypes.Level: { _startScreenCanvas.SetActive(false); _instructionsScreenCanvas.SetActive(false); _optionsScreenCanvas.SetActive(false); _creditsScreenCanvas.SetActive(false); _levelScreenCanvas.SetActive(true); _gameOverScreenCanvas.SetActive(false); _pauseMenuCanvas.SetActive(false); Persistency.LoadSavedData(Persistency.DataGroups.Score); break; } case SceneController.SceneTypes.GameOver: { _startScreenCanvas.SetActive(false); _instructionsScreenCanvas.SetActive(false); _optionsScreenCanvas.SetActive(false); _creditsScreenCanvas.SetActive(false); _levelScreenCanvas.SetActive(false); _gameOverScreenCanvas.SetActive(true); _pauseMenuCanvas.SetActive(false); ShowGameOverResult(GameController.instance.newRecord); break; } default: { _startScreenCanvas.SetActive(false); _instructionsScreenCanvas.SetActive(false); _optionsScreenCanvas.SetActive(false); _creditsScreenCanvas.SetActive(false); _levelScreenCanvas.SetActive(false); _gameOverScreenCanvas.SetActive(false); _pauseMenuCanvas.SetActive(false); break; } } }
public void EnableSceneCanvas() { ChooseCanvas(); LinkCanvasElements(); Persistency.LoadSavedData(Persistency.DataGroups.Sound); }
public PersistentAttribute(Persistency persistency) { Persistency = persistency; }