/// <summary> /// 初始化 /// </summary> public void Init() { coolDownTimer = new CountDownTimer(coolDownTime); if (!coolDownAtStart) { coolDownTimer.End(); } if (buttonFullImg != null) { buttonFullImg.fillAmount = coolDownAtStart ? 1 : 0; } button.onClick.AddListener(OnClick); }
/// <summary> /// A Method to Reset the Timer based on a cooldown value /// </summary> /// <param name="cd"> cooldown</param> private void ResetTimer(float cd) { cdTimer = new CountDownTimer(cd); // Create a timer for 5 seconds cdTimer.End(); }