コード例 #1
0
ファイル: UITowerInfo.cs プロジェクト: j1mmyto9/TowerDefense
        public void _Show(UnitTower tower, bool showControl = false)
        {
            isOn = true;
            thisObj.SetActive(showControl);
            rscObj.SetActive(!showControl);
            currentTower = tower;

            if (showControl)
            {
                if (currentTower.IsInConstruction())
                {
                    StartCoroutine(WaitForConstruction());
                    floatingButtons.SetActive(false);
                    butSell.SetActive(false);
                    butUpgradeAlt1.SetActive(false);
                    butUpgrade.SetActive(false);
                }
                else
                {
                    floatingButtons.SetActive(true);
                    butSell.SetActive(true);
                    txtSell.text  = "" + currentTower.GetValueSell();
                    upgradeOption = currentTower.ReadyToBeUpgrade();
                    if (upgradeOption > 0)
                    {
                        butUpgrade.SetActive(true);
                        txtUpgrade.text = "" + currentTower.GetCost();
                        if (upgradeOption > 1)
                        {
                            butUpgradeAlt1.SetActive(true);
                            txtUpgradeAlt1.text = "" + currentTower.GetCost(1);
                        }
                        else
                        {
                            butUpgradeAlt1.SetActive(false);
                        }
                    }
                    else
                    {
                        butUpgrade.SetActive(false);
                        butUpgradeAlt1.SetActive(false);
                    }
                }
            }
            else
            {
                int cost = currentTower.GetCost();
                txtRsc.text = cost.ToString();
            }

            Update();

            txtName.text  = tower.unitName;
            txtDesp1.text = tower.GetDespStats();
            txtDesp2.text = tower.GetDespGeneral();

            thisObj.SetActive(isOn);
        }
コード例 #2
0
ファイル: UITowerInfo.cs プロジェクト: tscheipel/BEER
        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);
                }
                else
                {
                    butUpgrade.SetActive(false);
                }

                // deactivate the priority settings for support and electricity towers
                if (tower.type != _TowerType.Turret)
                {
                    priorityObj.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);
        }
コード例 #3
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);
        }
コード例 #4
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);
        }
コード例 #5
0
ファイル: UITowerInfo.cs プロジェクト: toooooooo/BEER
        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);
                }
                else{
                    butUpgrade.SetActive(false);
                }

            // deactivate the priority settings for support and electricity towers
            if (tower.type != _TowerType.Turret)
            {
              priorityObj.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);
        }
コード例 #6
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);
		}