public Vector3 GetScreenPos(Vector3 worldPos)
        {
            Vector3 screenPos = Camera.main.WorldToScreenPoint(worldPos) * UIMainControl.GetScaleFactor();

            screenPos.z = 0;
            return(screenPos);
        }
Exemple #2
0
        // Update is called once per frame
        void LateUpdate()
        {
            if (unit == null)
            {
                if (gameObject.activeInHierarchy)
                {
                    gameObject.SetActive(false);
                }
                return;
            }

            Vector3 screenPos = Camera.main.WorldToScreenPoint(unit.thisT.position);

            screenPos.z         = 0;
            rectT.localPosition = (screenPos + new Vector3(0, posOffset)) * UIMainControl.GetScaleFactor();

            sliderHP.value = unit.GetHPRatio();
            sliderAP.value = unit.GetAPRatio();
            textHP.text    = unit.HP + " / " + unit.GetFullHP();
            textAP.text    = unit.AP + " / " + unit.GetFullAP();

            canvasGroup.alpha = (unit.thisObj.layer == TBTK.GetLayerUnitInvisible() ? 0 :  1);

            //_CoverType{None, Half, Full}
            if ((int)unit.coverStatus != currentCoverStatus)
            {
                currentCoverStatus = (int)unit.coverStatus;
                if (currentCoverStatus == 1)
                {
                    imgCoverIcon.sprite = spriteHalfCover;
                }
                if (currentCoverStatus == 2)
                {
                    imgCoverIcon.sprite = spriteFullCover;
                }
                imgCoverIcon.enabled = !(currentCoverStatus == 0);
            }
        }
Exemple #3
0
        void UpdateTooltipPos()
        {
            Vector3 screenPos = Camera.main.WorldToScreenPoint(lastHoveredTile.GetPos());

            tooltipRectT.localPosition = (screenPos + new Vector3(offset.x, offset.y + verticalOffset, 0)) * UIMainControl.GetScaleFactor();
        }