using UnityEngine;
using System.Collections;

public class BandageScript : MonoBehaviour {

	// Use this for initialization
	public GameObject playerREF;
	
	MummyScript mummyREF;
	public GameObject shinePSO;
	ParticleSystem shine_PS;
	
	// Use this for initialization
	void Start () {
	
		mummyREF = playerREF.GetComponent<MummyScript> ();
		shine_PS = shinePSO.GetComponent<ParticleSystem> ();
	}
	
	// Update is called once per frame
	void Update  () {
		
		/*if(Physics2D.IsTouching((Collider2D)GetComponent<BoxCollider2D>(), (Collider2D)circleREF))
		{
			if(mummyREF.onFire)
			{
				Destroy(gameObject);
			}
		}*/
		
	}
	
	void OnTriggerEnter2D(Collider2D col_Info)
	{
		if(col_Info.gameObject.name == "mummy")
		{
			mummyREF.health += 2.0f;
			if(mummyREF.health > mummyREF.max_health)
				mummyREF.health = mummyREF.max_health;
			shine_PS.Stop ();
			Destroy(gameObject.GetComponent<SpriteRenderer>());
			Destroy(gameObject.GetComponent<BoxCollider2D>());
			Destroy(shinePSO, 2.0f);
			Destroy(this, 2.0f);
		}
	}
}
