Exemplo n.º 1
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.gameObject.tag.Contains("Player") && !other.gameObject.CompareTag("PlayerProjectile"))
     {
         PlayerMovement player = other.gameObject.GetComponent <PlayerMovement>();
         player.AddLife();
         //playsound
         Destroy(this.gameObject);
     }
 }
Exemplo n.º 2
0
 private void OnTriggerEnter2D(Collider2D other)
 {
     if (other.tag == "Player")
     {
         player.AddLife(1);
         addLife.Play();
         Debug.Log("Aumenta la vida");
         gameObject.SetActive(false);
     }
 }