Exemple #1
0
    public void Return()
    {
        SceneManager.LoadScene(_previousScene);
        Persistency.SaveData(Persistency.DataGroups.Sound);

        // if (instance._previousScene != SceneManager.GetActiveScene().buildIndex)
        // {
        //     instance._previousScene = SceneManager.GetActiveScene().buildIndex;
        // }
    }
Exemple #2
0
    void OnTriggerEnter(Collider other)
    {
        if (!shine.activeSelf)
        {
            shine.SetActive(true);
            particle.Play();
            audio.Play();

            Persistency.SetCheckpoint(gameObject);
        }
    }
Exemple #3
0
    void Awake()
    {
        if (instance != null)
        {
            Destroy(gameObject);
            return;
        }

        DontDestroyOnLoad(gameObject);
        instance         = this;
        checkpointLevel  = Application.loadedLevel;
        checkpointStatue = GameObject.Find("Checkpoint");
    }
Exemple #4
0
    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;
 }
Exemple #6
0
 private void Start()
 {
     Persistency.LoadSavedData(Persistency.DataGroups.Sound);
 }
Exemple #7
0
 void OnDeath()
 {
     Persistency.OnDeath();
     Destroy(gameObject);
 }
Exemple #8
0
    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;
        }
        }
    }
Exemple #9
0
 public void EnableSceneCanvas()
 {
     ChooseCanvas();
     LinkCanvasElements();
     Persistency.LoadSavedData(Persistency.DataGroups.Sound);
 }
Exemple #10
0
 public PersistentAttribute(Persistency persistency)
 {
     Persistency = persistency;
 }