private void initialize(int[] caps, string coreID)
    {
        this.caps   = caps;
        this.coreID = coreID;

        for (int i = 0; i < 4; i++)
        {
            DrawSlots(i);
            var x      = i;
            var button = slotHolders[i].GetChild(0).GetComponent <Button>();
            button.onClick.RemoveAllListeners();
            button.onClick.AddListener(() => {
                if (CoreUpgraderScript.GetUpgradeCost(x) <= CoreUpgraderScript.GetShards())
                {
                    CoreUpgraderScript.IncrementAbilityCap(x);
                }
                DrawSlots(x);
            });
        }
    }
Beispiel #2
0
 public void UpdateButtonCost(bool mouseOver)
 {
     if (CoreUpgraderScript.maxAbilityCap[type] > CoreUpgraderScript.instance.player.abilityCaps[type])
     {
         if (mouseOver)
         {
             text.text  = $"{CoreUpgraderScript.GetUpgradeCost(type)} Shards";
             text.color = CoreUpgraderScript.GetUpgradeCost(type) - CoreUpgraderScript.GetShards() <= 0 ? Color.green : Color.red;
         }
         else
         {
             text.text  = "Upgrade";
             text.color = Color.white;
         }
     }
     else
     {
         text.text  = "MAX";
         text.color = Color.yellow;
     }
 }