using UnityEngine;
using System.Collections;

public class Area : MonoBehaviour {

	public string resource;
	public float harvestRate;

	public bool HasResources { get { return resource != null && resource.Length > 0; } }

	public string name;

	[HideInInspector]
	public float totalWorkForce = 0;

	protected virtual void Start () {
		if (name == "goat-center")
			Goat.goatCenter = transform.position;
	}

	void OnTriggerEnter2D (Collider2D other) {
		other.GetComponent<Movable>().OnEnterArea(this);
		OnWorkForceChanged();
	}

	void OnTriggerExit2D (Collider2D other) {
		other.GetComponent<Movable>().OnExitArea(this);
		OnWorkForceChanged();
	}

	public virtual void OnWorkForceChanged () { }
}
