Ejemplo n.º 1
0
        public void _ShowUpgrade(UnitTower tower, int uIdx, Vector3 pos, int pivotCorner = 2, Vector3 offset = default(Vector3))
        {
            SetPivot(pivotCorner);

            if (tower.GetUpgradeType() == 0)
            {
                labelName.text = "Upgrade";
            }
            else
            {
                labelName.text = "Upgrade to" + tower.GetUpgradeTower(uIdx).unitName;
            }

            labelDesp.enabled = false;

            List <float> cost = tower.GetUpgradeCost(uIdx);

            for (int i = 0; i < RscManager.GetResourceCount(); i++)
            {
                rscItemList[i].imgMain.sprite = RscManager.GetRscIcon(i);
                rscItemList[i].lbMain.text    = cost[i].ToString("f0");
            }

            minHeight      = -1;
            rectT.position = pos + offset;

            canvasGroup.alpha = 1;
            thisObj.SetActive(true);
        }
Ejemplo n.º 2
0
        public void OnUpgradeButton(GameObject butObj, int pointerID = -1)
        {
            int idx = UI.GetItemIndex(butObj, upgradeButtons);

            List <float> upgradeCost = sTower.GetUpgradeCost(idx);

            if (CheckCost(upgradeCost))
            {
                //RscManager.SpendRsc(upgradeCost);
                sTower.Upgrade(idx);
                SelectControl.ClearUnit();
                Hide();
            }

            UITooltip.Hide();
        }