示例#1
0
    private void Update()
    {
        if (thisBarracks.GetComponent<Buildings>().isActivated)
        {
            panelChild.gameObject.SetActive(true);
            isBarracksActive = true;
        }
        else
        {
            panelChild.gameObject.SetActive(false);
            isBarracksActive = false;
        }

        if (isBarracksActive)
        {
            GetComponent<RectTransform>().position = Camera.main.WorldToScreenPoint(thisBarracks.transform.position);
        }
    }