예제 #1
0
 // Start is called before the first frame update
 void Start()
 {
     plantManager = PlantsManager.Instance;
     //init stats
     hudByProperty = new Dictionary <PlantProperty, OneStatHud>();
     foreach (var pair in plantManager.currentResource)
     {
         GameObject oneStatInstance = Instantiate(oneStatPrefab, statsContent.transform);
         OneStatHud oneStatHud      = oneStatInstance.GetComponent <OneStatHud>();
         hudByProperty[pair.Key] = oneStatHud;
     }
     //init plant buttons
     UpdatePlantButtons();
 }
예제 #2
0
 // Update is called once per frame
 void Update()
 {
     foreach (var pair in plantManager.currentResource)
     {
         OneStatHud oneStatHud = hudByProperty[pair.Key];
         if (!plantManager.isResourceUnlocked.ContainsKey(pair.Key))
         {
             oneStatHud.gameObject.SetActive(false);
             oneStatHud.transform.position = statsContent.transform.position;
         }
         else
         {
             oneStatHud.gameObject.SetActive(true);
         }
         oneStatHud.init(plantManager.resourceName[pair.Key], propertyImage[(int)pair.Key], pair.Value);
     }
 }