Exemplo n.º 1
0
    /// <summary>
    /// The dying process.
    /// </summary>
    /// <returns>IEnumerator for waiting an amount of time</returns>
    private IEnumerator Die()
    {
        _timeManager.StopTimer();
        yield return(new WaitForSeconds(1f)); // Wait some time before executiong the die process.

        Debug.Log("Player has lost one life.");
        _livesManager.LoseLife();
        if (_livesManager.NoMoreLives())
        {
            Debug.Log("No more lives");
            StartCoroutine(GameOver());
        }
        else
        {
            _groundController.RestartGround();
            _ballController.Reborn();
            _timeManager.ResumeTimer();
            _cameraController.RestartCamera();
        }
    }