using UnityEngine;
using System.Collections;

public class ChangeScene : MonoBehaviour {

	// Use this for initialization
    public string worldDestiny;
    public int exitID = 0;
    public bool hover = false;
    public string msg = "";
    private Vector3 point;
    private Rect t;
    GameObject p;
    
    void OnTriggerEnter(Collider col) {
        p = col.gameObject;

        if (p.tag== "Player") {
            hover = true;
            
        }
    }


    void OnTriggerExit(Collider col) {
        p = col.gameObject;

        if (p.tag == "Player") {
            hover = false;
        }
    }

    public void setAction() {
        Player pa = GameObject.Find("PlayerBody").GetComponent<Player>();
        pa.playerStats.auxExit = exitID;

        LoadSavePlayerStats.saveTMP(pa.playerStats);
        Application.LoadLevel(worldDestiny);
    }

    void OnGUI() {
        if (hover) {
            this.point = Camera.main.WorldToScreenPoint(this.gameObject.transform.position);
            this.t = new Rect(point.x, point.y, 300, 300);
            GUI.Label(this.t, "<size=" + ((50)) + ">" + "Going to " + msg + "</size>");
        }
    }

}
