示例#1
0
    void OnCollisionEnter2D(Collision2D collision)
    {
        // Sets isJumping to 'false' when it touches the ground.
        if (collision.transform.tag == "Ground" || collision.transform.tag == "Platform")
        {
            isJumping = false;
        }

        // Kills Hero if hero hits any objects tagged as hazard
        else if (collision.transform.tag == "Hazard")
        {
            //timer.DecreaseLives ();
            //Destroy (gameObject);
            //StartCoroutine(respawn ());

            StartCoroutine(respawn());
            GameObject.Instantiate(explosion, transform.position, transform.rotation);
            timer.DecreaseLives();
        }
    }