void Awake(){
			instance=this;
			
			for(int i=0; i<3; i++){
				if(i>0){
					GameObject obj=(GameObject)Instantiate(buildingBarList[0].gameObject);
					buildingBarList.Add(obj.GetComponent<Slider>());
					buildingBarList[i].transform.SetParent(buildingBarList[0].transform.parent);
				}
				buildingBarList[i].gameObject.SetActive(false);
			}
			
			for(int i=0; i<10; i++){
				if(i>0){
					GameObject obj=(GameObject)Instantiate(textOverlayList[0].gameObject);
					textOverlayList.Add(obj.GetComponent<Text>());
					textOverlayList[i].transform.SetParent(textOverlayList[0].transform.parent);
				}
				textOverlayList[i].text="";
				textOverlayList[i].gameObject.SetActive(false);
			}
			
			for(int i=0; i<15; i++){
				if(i==0) overlayList[i].Init();
				else overlayList.Add(overlayList[0].Clone());
				overlayList[i].rootObj.SetActive(false);
			}
			
			mainCam=Camera.main;
		}
Exemple #2
0
 private void buildFinished()
 {
     if (electricityFacility)
     {
         UIOverlay.NewElectricity(this);
         StartCoroutine(GenerateEnergyRoutine(this));
     }
     else if (electricityReciever)
     {
         UIOverlay.NewElectricityReciever(this);
         // StartCoroutine(GenerateEnergyRoutine(this));
     }
     // new TextOverlay(thisT.position, "100", new Color(0f, 1f, .4f, 1f));
     // if (onDamagedE != null) onDamagedE(this);
 }
Exemple #3
0
        void Awake()
        {
            instance = this;

            for (int i = 0; i < 3; i++)
            {
                if (i > 0)
                {
                    GameObject obj = (GameObject)Instantiate(buildingBarList[0].gameObject);
                    buildingBarList.Add(obj.GetComponent <Slider>());
                    buildingBarList[i].transform.SetParent(buildingBarList[0].transform.parent);
                }
                buildingBarList[i].gameObject.SetActive(false);
            }

            for (int i = 0; i < 10; i++)
            {
                if (i > 0)
                {
                    GameObject obj = (GameObject)Instantiate(textOverlayList[0].gameObject);
                    textOverlayList.Add(obj.GetComponent <Text>());
                    textOverlayList[i].transform.SetParent(textOverlayList[0].transform.parent);
                }
                textOverlayList[i].text = "";
                textOverlayList[i].gameObject.SetActive(false);
            }

            for (int i = 0; i < 15; i++)
            {
                if (i == 0)
                {
                    overlayList[i].Init();
                }
                else
                {
                    overlayList.Add(overlayList[0].Clone());
                }
                overlayList[i].rootObj.SetActive(false);
            }

            mainCam = Camera.main;
        }