Beispiel #1
0
        public void UpdateDisplay()
        {
            if (currentTower == null)
            {
                return;
            }

            lbTowerName.text  = currentTower.unitName;
            lbTowerLevel.text = "lvl" + currentTower.GetLevel();
            lbTowerDesp1.text = "damage: " + currentTower.GetDamageMin() + "-" + currentTower.GetDamageMax();
            lbTowerDesp1.text = currentTower.GetDespStats();          //"damage: "+currentTower.GetDamageMin()+"-"+currentTower.GetDamageMax();
            lbTowerDesp2.text = currentTower.GetDespGeneral();


            sliderDrection.value = currentTower.dirScanAngle;
            directionControlObj.SetActive(currentTower.directionalTargeting);


            int upgradeOption = currentTower.ReadyToBeUpgrade();

            butUpgrade1Canvas.alpha        = upgradeOption >= 1 ? 1 : 0;
            butUpgrade1Canvas.interactable = upgradeOption >= 1 ? true : false;
            butUpgrade2Canvas.alpha        = upgradeOption >= 2 ? 1 : 0;
            butUpgrade2Canvas.interactable = upgradeOption >= 2 ? true : false;
            //butUpgradeObj1.SetActive(upgradeOption>=1 ? true : false);
            //butUpgradeObj2.SetActive(upgradeOption>=2 ? true : false);

            butSellObj.SetActive(currentTower.canBeSold);

            bool enableFPS = FPSControl.ActiveInScene();

            if (enableFPS && currentTower.disableFPS)
            {
                enableFPS = false;
            }
            if (enableFPS && FPSControl.UseTowerWeapon() && currentTower.FPSWeaponID == -1)
            {
                enableFPS = false;
            }
            if (enableFPS && !FPSControl.IsIDAvailable(currentTower.FPSWeaponID))
            {
                enableFPS = false;
            }
            butFPSObj.SetActive(enableFPS);
        }
Beispiel #2
0
        public void _Show(UnitTower tower, bool showControl = false)
        {
            isOn = true;

            thisObj.SetActive(showControl);
            floatingButtons.SetActive(showControl);
            controlObj.SetActive(showControl);
            rscObj.SetActive(!showControl);

            currentTower = tower;

            if (showControl)
            {
                if (currentTower.IsInConstruction())
                {
                    StartCoroutine(WaitForConstruction());
                    floatingButtons.SetActive(false);
                }

                upgradeOption = currentTower.ReadyToBeUpgrade();
                if (upgradeOption > 0)
                {
                    butUpgrade.SetActive(true);
                    if (upgradeOption > 1)
                    {
                        butUpgradeAlt1.SetActive(true);
                    }
                    else
                    {
                        butUpgradeAlt1.SetActive(false);
                    }
                }
                else
                {
                    butUpgrade.SetActive(false);
                    butUpgradeAlt1.SetActive(false);
                }

                txtTargetPriority.text = tower.targetPriority.ToString();
                if (tower.directionalTargeting)
                {
                    directionObj.SetActive(true);
                    sliderDirection.value = tower.dirScanAngle;
                }
                else
                {
                    directionObj.SetActive(false);
                }

                if (FPSControl.ActiveInScene())
                {
                    if (FPSControl.UseTowerWeapon() && currentTower.FPSWeaponID == -1)
                    {
                        fpsButtonObj.SetActive(false);
                    }
                    else
                    {
                        fpsButtonObj.SetActive(true);
                    }
                }
                else
                {
                    fpsButtonObj.SetActive(false);
                }
            }
            else
            {
                List <int> cost = currentTower.GetCost();
                for (int i = 0; i < rscObjList.Count; i++)
                {
                    rscObjList[i].label.text = cost[i].ToString();
                }
            }

            Update();

            txtName.text  = tower.unitName;
            txtLvl.text   = "lvl" + tower.GetLevel();
            txtDesp1.text = tower.GetDespStats();
            txtDesp2.text = tower.GetDespGeneral();

            thisObj.SetActive(isOn);
        }