using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class DieOnCollision : MonoBehaviour {

	// Use this for initialization
	void Start () {
	    //Debug.Log("Alive");
	}
	
	// Update is called once per frame
	void Update () {
	}

	void OnTriggerEnter2D(Collider2D collision)
	{
	    if (collision.tag == "Player")
	    {
	        collision.GetComponent<Rigidbody2D>().velocity = Vector2.zero;
	        PlayerHealth playerHealth = collision.GetComponent<PlayerHealth>();

	        playerHealth.Die();
	    }
		Debug.Log("Trigger enter: " + collision.name );
    }
}
