Advertisement
Guest User

Upgrades

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