using UnityEngine;

public class PowerupController : MonoBehaviour {

	public void Start () {
		
	}

	public void Update () {
		if (transform.position.y < LevelManager.Instance.Floor.transform.position.y + 3) {
			Destroy(gameObject);  // Didn't catch it.
		}
	}

	public void OnCollisionEnter2D(Collision2D coll) {
		if (coll.gameObject.tag == "Worm" || coll.gameObject.tag == "Projectile") {
			// The player caught it.
			LevelManager.Instance.InstantiateHeart();
			Instantiate(LevelManager.Instance.EnemyDeathPrefab, transform.position, transform.rotation);  // EnemyDeath.
			GameObject.Destroy(gameObject);
		}
    }
}
