Exemplo n.º 1
0
        void UpdateDisplay()
        {
            lbTowerName.text = sTower.unitName;
            lbTowerDesp.text = sTower.desp;

            int upgradeType  = sTower.GetUpgradeType();                 //0-to next level, 1-to next tower
            int upgradeCount = sTower.GetUpgradeOptionCount();

            for (int i = 0; i < upgradeButtons.Count; i++)
            {
                if (i < upgradeCount)
                {
                    if (upgradeType == 0)
                    {
                        upgradeButtons[i].lbMain.text     = sTower.GetUpgradeCost()[0].ToString("f0");                  //"next level";
                        upgradeButtons[i].imgMain.enabled = false;
                        upgradeButtons[i].imgAlt.enabled  = true;
                    }
                    else if (upgradeType == 1)
                    {
                        UnitTower nextTower = sTower.GetUpgradeTower(i);
                        upgradeButtons[i].lbMain.text     = nextTower.GetCost()[0].ToString("f0");
                        upgradeButtons[i].imgMain.sprite  = nextTower.icon;
                        upgradeButtons[i].imgMain.enabled = true;
                        upgradeButtons[i].imgAlt.enabled  = false;
                    }

                    upgradeButtons[i].SetActive(true);
                }
                else
                {
                    upgradeButtons[i].SetActive(false);
                }
            }

            buttonSell.lbMain.text = sTower.GetSellValue()[0].ToString("f0");
            buttonSell.SetActive(!sTower.disableSelling);

            targetModeObj.SetActive(sTower.IsTurret() && allowTargetModeSwitch);
            UpdateTargetModeDisplay();

            targetDirObj.SetActive(sTower.IsTurret() && sTower.UseDirectionalTargeting() && allowTargetDirSwitch);
            sliderTargetDir.value = sTower.targetingDir;
        }