using UnityEngine;
using System.Collections;

public class UrnScript : MonoBehaviour {

	public GameObject playerREF;
	
	MummyScript mummyREF;
	public GameObject waterPSO;
	ParticleSystem water_PS;
	
	// Use this for initialization
	void Start () {
	
		mummyREF = playerREF.GetComponent<MummyScript> ();
		water_PS = waterPSO.GetComponent<ParticleSystem> ();
	}
	
	// Update is called once per frame
	void Update  () {
		
		/*if(Physics2D.IsTouching((Collider2D)GetComponent<BoxCollider2D>(), (Collider2D)circleREF))
		{
			if(mummyREF.onFire)
			{
				Destroy(gameObject);
			}
		}*/
		
	}
	
	void OnCollisionEnter2D(Collision2D col_Info)
	{
		if(col_Info.gameObject.name == "mummy")
		{
			mummyREF.GetWet();

			Destroy(GetComponent<BoxCollider2D>());
			Destroy(GetComponent<SpriteRenderer>());
			water_PS.playOnAwake = true;
			water_PS.Play ();
			Destroy(gameObject, 2.0f);
			Destroy(waterPSO, 2.0f);
		}
	}
}
