Пример #1
0
 public void UpdatePlantButtons()
 {
     foreach (Transform go in plantsContent.transform)
     {
         Destroy(go.gameObject);
     }
     foreach (var go in plantManager.helperPlantList)
     {
         if ((!plantManager.isPlantUnlocked.ContainsKey(go.GetComponent <HelperPlant>().type) || plantManager.isPlantUnlocked[go.GetComponent <HelperPlant>().type]) || plantManager.unlockAllFlowers)
         {
             foreach (var plantType in plantManager.levelToPlants[plantManager.mainTreePrefab.GetComponent <MainTree>().upgradeList[0]])
             {
                 if (plantType == go.GetComponent <HelperPlant>().type)
                 {
                     GameObject   buttonInstance      = Instantiate(plantButtonPrefab, plantsContent.transform);
                     PlantsButton plantButtonInstance = buttonInstance.GetComponent <PlantsButton>();
                     plantButtonInstance.init(go, this);
                 }
             }
         }
     }
 }
Пример #2
0
    public void UpdatePlantButtons()
    {
        foreach (Transform go in plantsContent.transform)
        {
            Destroy(go.gameObject);
        }
        foreach (var pair in plantManager.helperPlantDict)
        {
            var type = pair.Key;

            if ((!plantManager.isPlantUnlocked.ContainsKey(type) || plantManager.isPlantUnlocked[type]) || plantManager.unlockAllFlowers)
            {
                {
                    {
                        GameObject   buttonInstance      = Instantiate(plantButtonPrefab, plantsContent.transform);
                        PlantsButton plantButtonInstance = buttonInstance.GetComponent <PlantsButton>();
                        plantButtonInstance.init(pair.Value, this);
                    }
                }
            }
        }
    }