Advertisement
Guest User

Untitled

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