Esempio n. 1
0
    // Update is called once per frame
    void Update()
    {
        if (hasInfo && initiated)
        {
            if (bs.IsExploded())
            {
                BuildingScript bs = this.transform.parent.parent.parent.gameObject.GetComponent <BuildingScript> ();
                if (bs.IsMagnified())
                {
                    tooltip.SetActive(true);
                }
                else
                {
                    tooltip.SetActive(false);
                }



                //Camera realCamera = Camera.main;
                //if (realCamera != null)
                //{
                //    Vector3 viewPos = realCamera.WorldToViewportPoint(this.transform.position);
                //    if (viewPos.x > 0 && viewPos.y > 0 && viewPos.z > 0)
                //    {
                //        tooltip.SetActive(true);
                //    }
                //    else {
                //        tooltip.SetActive(false);
                //    }
                //}
            }
            else
            {
                tooltip.SetActive(false);
            }
        }
    }