// Start is called before the first frame update void Start() { rb = GetComponent <Rigidbody2D>(); Destroy(gameObject, 8); puntajeControllerK = FindObjectOfType <PuntajeController>(); Debug.Log(puntajeControllerK.GetPuntos()); }
void OnCollisionEnter2D(Collision2D other) { if (other.gameObject.tag == "enemigo") { Destroy(other.gameObject); Destroy(this.gameObject); puntajeControllerK.AddPuntos(10); Debug.Log(puntajeControllerK.GetPuntos()); } }
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"); } }