| | |
| | | using System.Collections; |
| | | |
| | | |
| | | public class ButtonClickInterval : MonoBehaviour |
| | | public class ButtonClickInterval : MonoBehaviour |
| | | { |
| | | [SerializeField] float interval = 1f; |
| | | [SerializeField] Button targetBtn; |
| | | |
| | | private void Awake() |
| | | { |
| | | [SerializeField] float interval = 1f; |
| | | [SerializeField] Button targetBtn; |
| | | |
| | | private void Awake() |
| | | { |
| | | targetBtn.AddListener(OnClick); |
| | | } |
| | | |
| | | private void OnClick() |
| | | { |
| | | targetBtn.enabled = false; |
| | | StartCoroutine(DelayClick()); |
| | | } |
| | | |
| | | IEnumerator DelayClick() |
| | | { |
| | | yield return new WaitForSeconds(interval); |
| | | targetBtn.enabled = true; |
| | | } |
| | | targetBtn.AddListener(OnClick); |
| | | } |
| | | |
| | | private void OnClick() |
| | | { |
| | | targetBtn.enabled = false; |
| | | StartCoroutine(DelayClick()); |
| | | } |
| | | |
| | | IEnumerator DelayClick() |
| | | { |
| | | yield return new WaitForSeconds(interval); |
| | | targetBtn.enabled = true; |
| | | } |
| | | } |