using UnityEngine;

public class Resta : MonoBehaviour {
    GameController controller;
    public AudioSource golpe;
   // public AudioSource explosion;
    

	void Start () {
        GameObject cont = GameObject.Find("Canvas");
        controller = cont.GetComponent<GameController>();
	}

	void OnTriggerEnter2D (Collider2D other)
    {
		if (other.tag.Equals ("enemy")) {
			controller.RestaVida ();
			golpe.Play ();
			Destroy (other.gameObject);
		} else if (other.tag.Equals ("undestructibleEnemy")) {
			controller.RestaVida ();
			golpe.Play ();
		}
	}


}
