Advertisement
Guest User

ItemManager

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