Ejemplo n.º 1
0
 public void Init(Unit unit)
 {
     this.unit  = unit;
     resourceUI = Instantiate(resourcePrefab, Vector3.zero, Quaternion.identity, transform);
     resourceUI.gameObject.name = unit.CarriedResourceType.ToString() + "_Resource";
     resourceUI.gameObject.SetActive(false);
     resourceUI.Init();
 }
    private void AddResourceLabel(KeyValuePair <ResourceTypes, int> resource)
    {
        ResourceUI resourceUI = Instantiate(resourcePrefab, transform, false);

        resourceUI.transform.localPosition += new Vector3(0, offsetY, 0);
        offsetY += 30.0f;
        resourceUI.gameObject.SetActive(true);
        resourceUI.Init();
        resourceLabels.Add(resource.Key, resourceUI);
    }