Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using TMPro;
- using UnityEngine;
- using UnityEngine.UI;
- public class MoneyScript : MonoBehaviour
- {
- [SerializeField] TextMeshProUGUI MoneyText;
- [SerializeField] Text MultiAmount;
- [SerializeField] Button MultiButton;
- private ColorBlock theColor = new ColorBlock();
- double cash = 0;
- double cashToUpgrade = 50.00;
- double gain = 0.5;
- // Start is called before the first frame update
- void Start()
- {
- theColor.normalColor = Color.red;
- theColor.highlightedColor = Color.red;
- theColor.pressedColor = Color.red;
- theColor.disabledColor = Color.red;
- MultiButton.colors = theColor;
- MoneyText.text = "$ 0.00";
- MultiAmount.text = "$ 50.00";
- }
- // Update is called once per frame
- void Update()
- {
- }
- public void ClickMoney()
- {
- cash += (gain);
- MoneyText.text = $"$ {cash:00.00}";
- }
- public void ClickMulti()
- {
- if (cash >= cashToUpgrade)
- {
- cash -= cashToUpgrade;
- gain *= 1.5;
- cashToUpgrade *= 2;
- MoneyText.text = $"$ {cash:00.00}";
- MultiAmount.text = $"$ {cashToUpgrade:00.00}";
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement