Advertisement
Guest User

Untitled

a guest
Feb 20th, 2020
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5.  
  6. public class UpgradeManager : MonoBehaviour
  7. {
  8. public Click click;
  9. public Text itemInfo;
  10. public float cost;
  11. public int count = 0;
  12. public int clickPower;
  13. public string itemName;
  14. private float _newCost;
  15.  
  16. void Update()
  17. {
  18. itemInfo.text = itemName + "\nCost: " + cost + "\nPower: " + clickPower;
  19. }
  20.  
  21. public void PurchasedUpgrade()
  22. {
  23. if (click.gold >= cost)
  24. {
  25. click.gold -= cost;
  26. count += 1;
  27. click.goldperclick += clickPower;
  28. cost = Mathf.Round(cost * 1.15f);
  29. _newCost = Mathf.Pow(cost, _newCost = cost);
  30.  
  31. }
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement