예제 #1
0
    public static void RefreshGui()
    {
        if (activeStructure)
        {
            _strutName.SetText(activeStructure.GetStructure().StructureName);
            _strutDesc.SetText(activeStructure.GetStructure().Description);
            _reclaimBtn.transform.GetChild(0).gameObject.GetComponent <TMP_Text>().SetText("Reclaim (" + Mathf.FloorToInt(activeStructure.GetStructure().GoldCost * 3f) + ")");
            _upgradeBtn.transform.GetChild(0).GetComponent <TMP_Text>().SetText("Cannot Upgrade");
            var point = Camera.main.WorldToScreenPoint(activeStructure.GetStructure().transform.position);
            var x     = 0f;
            var y     = 0f;
            if (point.y >= .7f)
            {
                y = _panelRect.rect.height / 2;
            }
            else
            {
                y = -_panelRect.rect.height / 2;
            }

            _panelRect.position = point + new Vector3(x, y, 0);
        }
    }