예제 #1
0
    public void OnCollisionEnter2D(Collision2D collision)
    {
        if (collision.gameObject.tag == "BloqueBarra")
        {
            Estar = true;
            GC.MostrarBarra();
            Destroy(collision.gameObject);
        }
        ///revisa si toca el piso
        if (collision.gameObject.tag == "Plataforma")
        {
            GetComponent <Animator>().SetBool("Aire", false);
            cantsaltos = 0;
        }
        if ((collision.gameObject.tag == "Enemigo") && (lapsodaño <= 0))
        {
            lapsodaño += 1f;
            if (Health == 200)
            {
                vida.Damage(50);
            }
            Health = Health - 10;

            if (Health == 180)
            {
                vida.Damage(50);
                muerto = true;
                GC.DiegoMuertoEnLaPruebaDeDiseño();
                Destroy(gameObject);
            }
        }
        if (collision.gameObject.tag == "Vida")
        {
            if (Health == 190)
            {
                Health = Health + 10;
                vida.Recuperar(1 / 50);
                Destroy(collision.gameObject);
            }
            if (Health == 200)
            {
                Destroy(collision.gameObject);
            }
        }
        if (collision.gameObject.tag == "Muerte")
        {
            vida.Damage(100);
            muerto = true;
            GC.DiegoMuertoEnLaPruebaDeDiseño();
            Destroy(gameObject);
        }
        if (collision.gameObject.tag == "Power UP Salto")
        {
            if (Health == 190)
            {
                salto = 400;

                Destroy(collision.gameObject);
            }
            if (Health == 200)
            {
                salto = 400;
                Destroy(collision.gameObject);
            }
        }
        if (collision.gameObject.tag == "Power UP Velocidad")
        {
            if (Health == 190)
            {
                maxSpeed = 10;

                Destroy(collision.gameObject);
            }
            if (Health == 200)
            {
                maxSpeed = 10;
                Destroy(collision.gameObject);
            }
        }
    }