Beispiel #1
0
 public void CreateResourcesList(List <Cost> resources)
 {
     resourcesInfo = new List <ResourceInfo>();
     foreach (Cost resource in resources)
     {
         Transform positionList = resourcesHolder;
         if (ResourcesManager.Instance.IsMajorResource(resource.type))
         {
             positionList = majorResourcesHolder;
         }
         ResourceInfo resourceCreated = Instantiate(templateResourceInfo, Vector3.zero, Quaternion.identity, positionList);
         resourceCreated.Initialize(resource);
         resourcesInfo.Add(resourceCreated);
     }
 }
 public void CreateResourcesList(List <Cost> resources)
 {
     if (resourcesInfo != null && resourcesInfo.Count > 0)
     {
         foreach (ResourceInfo resourceInfo in resourcesInfo)
         {
             Destroy(resourceInfo.gameObject);
         }
         resourcesInfo.Clear();
     }
     resourcesInfo = new List <ResourceInfo>();
     foreach (Cost resource in resources)
     {
         ResourceInfo resourceCreated = Instantiate(templateResourceInfo, Vector3.zero, Quaternion.identity, panel.transform);
         resourceCreated.Initialize(resource);
         resourcesInfo.Add(resourceCreated);
     }
 }