void SetUpgradeCost() { UpgradeInfo dinoInfo = DinoInfo.Instance.GetDinoInfo(ShopInfo.shopDino); if (dinoInfo.IsMaxedOut(buttonMode)) { this.Hide(); } List <int> cost = dinoInfo.GetNextUpgradeCost(buttonMode); goldCost = cost[0]; geneCost = cost[1]; string goldPic = "[img=<40>]res://assets/icons/coins.png[/img]"; string genePic = "[img=<25>]res://assets/icons/dna.png[/img]"; string goldText = goldCost.ToString(); string geneText = geneCost.ToString(); if (goldCost > PlayerStats.gold) { goldText = String.Format("[color=#ff0000] {0} [/color]", goldText); } if (geneCost > PlayerStats.genes) { geneText = String.Format("[color=#ff0000] {0} [/color]", geneText); } BbcodeText = String.Format("{0}{1} {2}{3}", new string[] { goldPic, goldText, genePic, geneText }); }
void OnUpgradeButtonButtonDown() { // don't do anything if max upgrades reached if (dinoInfo.IsMaxedOut(statButtonMode)) { return; } // don't do anything if not enough gold/genes if (PlayerStats.gold < goldCost || PlayerStats.genes < geneCost) { return; } tween.InterpolateProperty(GetNode <TextureProgress>("TextureProgress"), "value", 0, 100, 1.5f); tween.Start(); }