using UnityEngine;
using System.Collections;

public class PositionHandler : MonoBehaviour {
	MyManager manager;
	public string destination = "WorldMap";
	public bool requireAction = false;

	void Awake()
	{
		manager = GameObject.Find("MyManager").GetComponent<MyManager>();
	}

	void OnTriggerStay2D(Collider2D col)
	{
		if(col.gameObject.name == "Player")
		{
			if(requireAction)
			{
				if(Input.GetButton("Jump"))
					manager.player.SetLocation(destination);
			}
			else
			{
				manager.player.SetLocation(destination);
			}
		}

	}
}
