Exemple #1
0
    public IEnumerator Die()
    {
        m_CoroutineRunning = true;

        PCamera camera = FindObjectOfType <PCamera>();

        Time.timeScale = 0.3f;

        yield return(new WaitForSecondsRealtime(1.0f));

        Instantiate(m_Debris, transform.position, transform.rotation);

        yield return(new WaitForSecondsRealtime(1.0f));

        StartCoroutine(camera.Shake(60.0f, 4.0f, 3f));

        yield return(new WaitForSecondsRealtime(1.0f));

        Time.timeScale = 1f;

        while (transform.position.y > -2000)
        {
            transform.position += new Vector3(0.0f, -1.0f, -0.77f) * 300.0f * Time.deltaTime;

            yield return(null);
        }

        yield return(new WaitForSecondsRealtime(1.0f));

        UnityEngine.SceneManagement.SceneManager.LoadScene(0);

        m_CoroutineRunning = false;
    }