Esempio n. 1
0
 // Use this for initialization
 void Start()
 {
     gameInfoManager = GameObject.Find("gameInfoManager");
     foreach (Transform item in this.transform.GetChild(1).transform.GetChild(0).transform.GetChild(0).transform)
     {
         if (item.tag == "R&DPlant")
         {
             plants.Add(item.gameObject);
         }
         if (item.tag == "R&DUpgrades")
         {
             plantUpgrades temp = new plantUpgrades();
             temp.parent = item.gameObject;
             foreach (Transform item2 in item.transform)
             {
                 temp.plantUpgradeList.Add(item2.gameObject);
             }
             temp.parent.SetActive(false);
             plantUpgradesList.Add(temp);
         }
     }
     for (int i = 0; i < plantUpgradesList.Count; i++)
     {
         for (int j = 0; j < plantUpgradesList[i].plantUpgradeList.Count; j++)
         {
             int[] arr = {i,j};
             plantUpgradesList[i].plantUpgradeList[j].GetComponent<Button>().onClick.AddListener(() => newUpgrade(arr));
         }
     }
 }
Esempio n. 2
0
 // Use this for initialization
 void Start()
 {
     gameInfoManager = GameObject.Find("gameInfoManager");
     foreach (Transform item in this.transform.GetChild(1).transform.GetChild(0).transform.GetChild(0).transform)
     {
         if (item.tag == "R&DPlant")
         {
             plants.Add(item.gameObject);
         }
         if (item.tag == "R&DUpgrades")
         {
             plantUpgrades temp = new plantUpgrades();
             temp.parent = item.gameObject;
             foreach (Transform item2 in item.transform)
             {
                 temp.plantUpgradeList.Add(item2.gameObject);
             }
             temp.parent.SetActive(false);
             plantUpgradesList.Add(temp);
         }
     }
     for (int i = 0; i < plantUpgradesList.Count; i++)
     {
         for (int j = 0; j < plantUpgradesList[i].plantUpgradeList.Count; j++)
         {
             int[] arr = { i, j };
             plantUpgradesList[i].plantUpgradeList[j].GetComponent <Button>().onClick.AddListener(() => newUpgrade(arr));
         }
     }
 }