Пример #1
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);
                }
                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);
        }
Пример #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);
		}