Example #1
0
    IEnumerator WaitAndReset()
    {
        if (resetTime < 3)
        {
            TrailPoint.bTrail = false;
            yield return(new WaitForSeconds(1));

            SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
        }
        else
        {
            scoreManager.LifeZero();
            resultText.DisplayResult("lose");
        }
    }
Example #2
0
    void Kill()
    {
        GetComponent <AudioSource>().Play();
        _spriteRenderer.enabled = false;
        GetComponent <Collider2D> ().enabled   = false;
        GetComponent <Rigidbody2D> ().bodyType = RigidbodyType2D.Kinematic;
        GetComponent <ParticleSystem> ().Play();

        resultText.DisplayResult("win");

        //Destroy(GameObject.Find ("Planks"));
        StartCoroutine(WaitToLevel(SceneManager.GetActiveScene().buildIndex + 1));
        Resetter.resetTime = 0;


        //PlayerPrefs.SetInt ("Score", Application.loadedLevel);
    }