Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using UnityEngine.UI;
- using System.Collections;
- [RequireComponent(typeof(Button))]
- public class Test : MonoBehaviour
- {
- [SerializeField] private int clickCount;
- [SerializeField] private int reloadCount;
- private Button button;
- private void Start()
- {
- button = GetComponent<Button>();
- }
- public void ButtonClick()
- {
- clickCount++;
- if (clickCount == 10)
- {
- clickCount = 0;
- reloadCount++;
- if(reloadCount != 3)
- StartCoroutine("ButtonReload");
- else
- {
- button.interactable = false;
- button.enabled = false;
- }
- }
- GameManager.balance += 50;
- }
- private IEnumerator ButtonReload()
- {
- button.interactable = false;
- yield return new WaitForSeconds(2f);
- button.interactable = true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement