Пример #1
0
        public IEnumerator BuildingBarRoutine(UnitTower tower)
        {
            Slider    bar  = buildingBarList[GetUnusedBuildingBarIndex()];
            Transform barT = bar.transform;

            bar.gameObject.SetActive(true);

            while (tower != null && tower.IsInConstruction())
            {
                bar.value = tower.GetBuildProgress();

                Vector3 screenPos = Camera.main.WorldToScreenPoint(tower.thisT.position + new Vector3(0, 0, 0));
                barT.localPosition = (screenPos + new Vector3(0, -20, 0)) * UIMainControl.GetScaleFactor();

                yield return(null);
            }

            bar.gameObject.SetActive(false);
        }
Пример #2
0
        IEnumerator _Building(UnitTower tower)
        {
            Slider    bar  = GetUnusedBuildingBar();
            Transform barT = bar.transform;

            while (tower != null && tower.IsInConstruction())
            {
                bar.value = tower.GetBuildProgress();

                if (mainCam == null)
                {
                    mainCam = Camera.main;
                    continue;
                }

                Vector3 screenPos = mainCam.WorldToScreenPoint(tower.thisT.position + new Vector3(0, 0, 0));
                barT.localPosition = screenPos + new Vector3(0, -20, 0);
                bar.gameObject.SetActive(true);

                yield return(null);
            }
            bar.gameObject.SetActive(false);
        }
Пример #3
0
		IEnumerator _Building(UnitTower tower){
			Slider bar=GetUnusedBuildingBar();
			Transform barT=bar.transform;
			while(tower!=null && tower.IsInConstruction()){
				bar.value=tower.GetBuildProgress();
				
				if(mainCam==null){
					mainCam=Camera.main;
					continue;
				}
				
				Vector3 screenPos = mainCam.WorldToScreenPoint(tower.thisT.position+new Vector3(0, 0, 0));
				barT.localPosition=(screenPos+new Vector3(0, -20, 0))/UI.GetScaleFactor();
				bar.gameObject.SetActive(true);
				
				yield return null;
			}
			bar.gameObject.SetActive(false);
		}