예제 #1
0
 /// <summary>
 /// If the resource cost of the entity has changed, update the resource elements on the card or
 /// hide them as appropriate.
 /// </summary>
 private void RefreshResourceCost()
 {
     if (energyCost != EntityView.GetEnergyCost() || mineralCost != EntityView.GetMineralCost())
     {
         foreach (Transform child in resourceContainer.transform)
         {
             Destroy(child.gameObject);
         }
         for (int i = 0; i < EntityView.GetEnergyCost(); i++)
         {
             GameObject go = Instantiate(energyIconPrefab);
             go.transform.SetParent(resourceContainer.transform);
             go.transform.localScale    = Vector3.one;
             go.transform.localPosition = Vector3.zero;
             go.transform.localRotation = Quaternion.identity;
         }
         for (int i = 0; i < EntityView.GetMineralCost(); i++)
         {
             GameObject go = Instantiate(mineralIconPrefab);
             go.transform.SetParent(resourceContainer.transform);
             go.transform.localScale    = Vector3.one;
             go.transform.localPosition = Vector3.zero;
             go.transform.localRotation = Quaternion.identity;
         }
         energyCost  = EntityView.GetEnergyCost();
         mineralCost = EntityView.GetMineralCost();
     }
 }