Hi everyone. I am creating a clicker on a unit, there is an improvement that doubles the clicks (it costs 100 clicks itself). So, I need help so that with each purchase of this improvement, its price doubles … I will be glad to everyone who will help!
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using System.Collections.Generic;
public class Clicker : MonoBehaviour
{
// --
public Transform ShopPan;
public Text MoneyText;
public int Money;
public int MoneyUp = 1;
private bool Check = true;
public int MainCamera;
public int Price;
public int PriceText;
// --
void Start()
{
Resolution[] resolution = Screen.resolutions;
Screen.SetResolution(resolution[resolution.Length - 1].width, resolution[resolution.Length - 1].height, true);
}
//--
void Update()
{
MoneyText.text = Money.ToString();
PriceText.text = Price.ToString();
}
// --
public void OnClickButton()
{
Money += MoneyUp;
}
//--
public void OnClickShopButton()
{
if (Check == true)
{
ShopPan.gameObject.SetActive(true);
Check = false;
}
else
{
ShopPan.gameObject.SetActive(false);
Check = true;
}
}
//--
public void OnClickBuy()
{
if (Money >= 100)
{
MoneyUp *= 2;
Money -= 100;
PriceText *= 3;
}
}
}