using UnityEngine;
using System.Collections;

public class monster : MonoBehaviour {

	// Use this for initialization
		//public fire sphere;
	public int mark;
	public bool loose;
	//string 
	// Use this for initialization
	void Start () {
	    mark = 0;
		loose = false ;
	}
	
	// Update is called once per frame
	void Update () {
	
	
	}
	
	void OnCollisionEnter(Collision sphere)
	{
	    	if(sphere.transform.position.x<gameObject.transform.position.x+0.86f
			&&sphere.transform.position.x>gameObject.transform.position.x-0.86f
			&&sphere.transform.position.z<gameObject.transform.position.z+0.40f
			&&sphere.transform.position.x>gameObject.transform.position.x-0.40f
			)
		{
			if(sphere.gameObject.tag == "Untagged")
			{
			mark+=1;
			Destroy(sphere.gameObject);
			Debug.Log("you got:"+mark);
			}
			if(sphere.gameObject.tag == "Finish")
			{
				loose = true;
				Destroy(sphere.gameObject);
			 //Destroy(gameObject);
			 Debug.Log("you loose");
			}
		}
		
	}
}
