Esempio n. 1
0
 void OnCollisionEnter2D(Collision2D other)
 {
     if (other.gameObject.tag == "enemigo")
     {
         Destroy(other.gameObject);
         Destroy(this.gameObject);
         puntajeControllerK.AddPuntos(10);
         Debug.Log(puntajeControllerK.GetPuntos());
     }
 }
Esempio n. 2
0
    private void OnCollisionEnter2D(Collision2D other)
    {
        if (other.gameObject.tag == "enemigo")
        {
            animator.SetInteger("Estado", ANIMATION_MORIR);
            muerto = true;
        }

        if (other.gameObject.tag == "Monedas")
        {
            coins = true;
            Destroy(other.gameObject);
            _audioSource.PlayOneShot(AudioMoneda);
            Puntaje.AddPuntos(5);
            Debug.Log(Puntaje.GetPuntos());
        }

        if (other.gameObject.layer == 8)
        {
            numSaltos = 0;
        }

        if (other.gameObject.name == "ArrowSign")
        {
            SceneManager.LoadScene("megaman");
        }

        /*Enter2d (una vez) al colicionar con algo
         * Stated2d (varias veces) mientras este colicionando con algo
         * Exit2d (una vez) al dejar de colicionar con algo*/

        if (other.gameObject.name == "Arbol")
        {
            Debug.Log("Colicion detectada");
        }
    }