using UnityEngine;
using System.Collections;

public class BeObserved : MonoBehaviour {

	public int beingObserved = 0;
	public int observedByPlayer = 0;

	// Update is called once per frame
	void Update () {
		if(beingObserved > 0)
		{
			GetComponent<FadeToTrans>().Reset();
		}
	}

	void OnTriggerEnter(Collider col){
		if(col.gameObject.GetComponent<Observer>() != null && col.gameObject.GetComponent<Observer>().playerNum == observedByPlayer)
		{
			beingObserved++;
		}
	}

	void OnTriggerExit(Collider col){
		if(col.gameObject.GetComponent<Observer>() != null && col.gameObject.GetComponent<Observer>().playerNum == observedByPlayer)
		{
			beingObserved--;
		}
	}
}
