using UnityEngine;
using System.Collections;
using UnityEngine.UI;

public class OnClickChangeUI : MonoBehaviour
{

    private GameObject GOinstance;
    private GameObject chat;
    private GameObject deadlist;
    private GameObject votePendu;
    CanvasGroup votePenduCanvas;
    Vector3 chatPos;
    Vector3 deadListPos;
    Vector3 away;

    // Use this for initialization
    void Start()
    {
        GOinstance = this.gameObject;
        chat = GameObject.Find("Canvas_chat");
        deadlist = GameObject.Find("dead_list");
        votePendu = GameObject.Find("PanelVotePendu");

        chatPos = new Vector3(-14.64F, 15.23F, 6.039996F); //chat.transform.position;
        deadListPos = new Vector3(-2.162F, 0.115F, 3.507F);//deadlist.transform.position;
        votePenduCanvas = votePendu.GetComponent<CanvasGroup>();
        votePenduCanvas.alpha = 0;
        away = new Vector3(1000, 1000);

        chat.transform.localPosition = away;
        deadlist.transform.localPosition = away;

        Debug.Log("chat : " + chatPos);
        Debug.Log("dead : " + deadListPos);
    }

    void OnMouseDown()
    {
        switch (GOinstance.transform.name)
        {
            case "Taverne":
                chat.transform.localPosition = chatPos;
                Debug.Log("Taverne");
                break;
            case "eglise_mdl":
                deadlist.transform.localPosition = deadListPos;
                Debug.Log("eglise");
                break;
            case "arbre_pendus_mdl":
                votePenduCanvas.alpha = 1;
                Debug.Log("pendu");
                break;
            default:
                break;
        }
    }

    // Update is called once per frame
    void Update()
    {

    }
}
