using UnityEngine;
using System.Collections;

public class TriggerEvent : MonoBehaviour {

    public string Objtag = "";
    public bool isHere = false;
    private GameObject physObj;

	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
	
	}
    void OnTriggerEnter(Collider other)
    {
        if (other.tag == Objtag)
        {
            print(other.name + "has entered");
            isHere = true;
            if(other.tag != "Player")
            {
                other.GetComponent<Rigidbody2D>().constraints = RigidbodyConstraints2D.FreezePosition;
            }
        }
    }
    void OnTriggerStay(Collider other)
    {
        print(other.name);
    }
    void OnTriggerExit(Collider other)
    {
        if (other.tag == Objtag)
        {
            print(other.name + "just left");
            isHere = false;
        }
     } 
}
