/*
     * void Update (){
     *
     *      if (Input.GetKeyUp (KeyCode.Q)){
     *              if (m_Buttonindex - 1 < 0) {
     *                      m_Buttonindex = maxButtonindex;
     *              } else {
     *                      m_Buttonindex -= 1;
     *              }
     *              OnHoverBuildButton (m_Buttonindex);
     *              m_UIBuildButton.buildButtons [m_Buttonindex].button.enabled = false;
     *      }else if(Input.GetKeyDown(KeyCode.Q)){
     *              m_UIBuildButton.OnExitBuildButton (m_UIBuildButton.buildButtons [m_Buttonindex].rootObj.gameObject);
     *              m_UIBuildButton.buildButtons [m_Buttonindex].button.enabled = true;
     *      }else if (Input.GetKeyUp (KeyCode.E)){
     *              m_UIBuildButton.OnBuildButton (m_UIBuildButton.buildButtons[m_Buttonindex].rootObj.gameObject,m_Buttonindex);
     *      }else if (Input.GetKeyUp (KeyCode.R)){
     *              m_UIBuildButton.buildButtons [m_Buttonindex].button.enabled = true;
     *              m_UIBuildButton.OnExitBuildButton (m_UIBuildButton.buildButtons [m_Buttonindex].rootObj.gameObject);
     *              m_Buttonindex = maxButtonindex;
     *              m_UIBuildButton.gameObject.SetActive (false);
     *      }
     *
     * }
     */
    public void OnBuildButton(int index)
    {
        if (index == 1)
        {
            m_Buttonindex = 2;
            m_UIBuildButton.OnExitBuildButton(m_UIBuildButton.buildButtons[2].rootObj.gameObject);
            m_UIBuildButton.buildButtons [m_Buttonindex].button.enabled = true;
            TowerManager.CreateDragNDropTower(m_TowerManager.buildableList[2]);
        }
        else
        {
            m_Buttonindex = 0;
            m_UIBuildButton.OnExitBuildButton(m_UIBuildButton.buildButtons [0].rootObj.gameObject);
            m_UIBuildButton.buildButtons [m_Buttonindex].button.enabled = true;
            TowerManager.CreateDragNDropTower(m_TowerManager.buildableList[0]);
        }



        //m_UIBuildButton.OnBuildButton (m_UIBuildButton.buildButtons[m_Buttonindex].rootObj.gameObject,m_Buttonindex);

        //UITooltip.Show (m_TowerManager.buildableList [m_Buttonindex], new Vector3 (0, 0, 0), m_Buttonindex, new Vector3 (0, 0, 0));
        //UITooltip.ShowUpgrade(m_TowerManager.buildableList [m_Buttonindex],m_Buttonindex,new Vector3 (0, 0, 0),m_Buttonindex, new Vector3 (0, 0, 0));
        //UITooltip.ShowSell (m_TowerManager.buildableList [m_Buttonindex], new Vector3 (0, 0, 0), m_Buttonindex, new Vector3 (0, 0, 0));
    }
 public void OnBuildButton2(int index)
 {
     if (index != 1)
     {
         m_UIBuildButton.OnExitBuildButton(m_UIBuildButton.buildButtons [1].rootObj.gameObject);
         m_UIBuildButton.buildButtons [m_Buttonindex].button.enabled = true;
         TowerManager.CreateDragNDropTower(m_TowerManager.buildableList [1]);
     }
     else
     {
         m_UIBuildButton.OnExitBuildButton(m_UIBuildButton.buildButtons [3].rootObj.gameObject);
         m_UIBuildButton.buildButtons [m_Buttonindex].button.enabled = true;
         TowerManager.CreateDragNDropTower(m_TowerManager.buildableList [3]);
     }
 }