Amount of Upgrades.
is there a way to keep track of how many upgrades youve bought?
so this is what i did but i didnt work.
code:
using UnityEngine;
using System.Collections;
public class UpgradeManger : MonoBehaviour {
public RPB click;
public UnityEngine.UI.Text itemInfo;
public UnityEngine.UI.Text items;
public float cost;
public int count = 0;
public int clickPower;
public string itemName;
private float _newCost;
[SerializeField] private float currentAmount;
[SerializeField] private float speed;
void Update() {
itemInfo.text = "\n$" + cost;
if (count > 24) {
speed = 50;
}
items.text = count;
}
public void PurchasedUpgrade() {
if (click.money >= cost) {
click.money -= cost;
count += 1;
click.moneyperclick += clickPower;
cost = Mathf.Round (cost * 1.05f);
_newCost = Mathf.Pow (cost, _newCost = cost);
}
if (count > 24) {
speed = 50;
}
}
}
error: Assets/UpgradeManger.cs(22,23): error CS0029: Cannot implicitly convert type int' to
string'
Comment
Best Answer
Answer by ZachAttack9280 · Oct 12, 2015 at 02:00 AM
I also tried it some where else and it still didnt work.
code:
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class RPB : MonoBehaviour {
public UnityEngine.UI.Text items;
public UnityEngine.UI.Text moneyEarned;
public UnityEngine.UI.Text moneyDisplay;
public Transform LoadingBar;
public Transform TextIndicator;
public Transform TextLoading;
[SerializeField] private float currentAmount;
[SerializeField] private float speed;
public float money = 0f;
public int moneyperclick = 1;
public int count;
void Update () {
items.text = count;
moneyDisplay.text = "$" + money;
moneyEarned.text = "$" + moneyperclick * 2;
if (currentAmount < 100) {
currentAmount += speed * Time.deltaTime;
TextIndicator.GetComponent<Text> ().text = ((int)currentAmount).ToString () + "%";
TextLoading.gameObject.SetActive (true);
} else {
TextLoading.gameObject.SetActive (false);
TextIndicator.GetComponent<Text> ().text = "Ready!";
}
LoadingBar.GetComponent<Image> ().fillAmount = currentAmount / 100;
}
public void clicked() {
if (currentAmount > 99) {
money += moneyperclick;
money = money + moneyperclick;
currentAmount = 0;
}
error: Assets/RPB.cs(20,23): error CS0029: Cannot implicitly convert type int' to
string'
Your answer
Follow this Question
Related Questions
Amount of Upgrades? 1 Answer
Problem with upgrade and long numbers 1 Answer
Text Label on an existing button [C#] 1 Answer
How to patch on Windows build game 0 Answers
i want to know when player buy a upgrade double the cost of upgrade 0 Answers