cdTimer = new CountDownTimer(coolDownTime); // 创建计时器,coolDownTime为持续时间,默认不自动循环,默认创建后自动开始。 在点击攻击时,如果计时器时间没结束,直接返回。否则就是结束冷却时间了,释放技能且重新开始计时器 if (!cdTimer.IsTimeUp) // 计时器没结束,直接返回 return; cdTimer.Start(); // ...
cdTimer = new CountDownTimer(coolDownTime); // 创建计时器,coolDownTime为持续时间,默认不自动循环,默认创建后自动开始。 在点击攻击时,如果计时器时间没结束,直接返回。否则就是结束冷却时间了,释放技能且重新开始计时器 if (!cdTimer.IsTimeUp) // 计时器没结束,直接返回 return; cdTimer.Start(); // ...
private void onTimeup(Timer timer) { print("计时完成"); } /// 倒计时间隔 private void onCD(Timer timer) { print(timer.repeatCount - timer.currentCount); // 3, 2, 1 } /// 倒计时结束 private void onCDEnd(Timer timer) { print(timer.repeatCount - timer.currentCount); // 0 ...
public class CountDownTimer : MonoBehaviour { public Text timerText; public float secondsCount; public int minuteCount; public int hourCount; void Update() { UpdateTimerUI(); } //call this on update public void UpdateTimerUI() { //set timer UI if(secondsCount > 0) secondsCount -= Time...
public void UpdataTimer() { if (isFinish) return; if (Time.time < finishTime) return; if (!isLoop) StopTimer(); else finishTime = Time.time + delyaTime; OnFinished?.Invoke(); } } 1. 2. 3. 4. 5. 6. 7. 8. 9.
{intcount =_usedTimes.Count;for(inti = count -1; i >=0; i--) { _usedTimes[i].Uptate(); } }publicvoidCancelTimer(Timer timer) { _usedTimes.Remove(timer);if(_canceledTimes.Count <10) { timer.Cancel(); _canceledTimes.Enqueue(timer); ...
{this.waitTimer.Update();if(this.waitTimer.HasElapsed()){// time's up// maybe reset or do something since duration is upreturn;}floatratio=this.waitTimer.GetRatio();// do something with ratio like interpolation (lerp)}privatevoidUpdateFire(){this.fireTimer.Update();if(this.fireTimer....
privatevoid_EnterInvincibleState()//进入无敌状态{_invincibleTimer+=Time.deltaTime;//记录无敌时间if(_invincibleTimer>=HIT_INVINCIBLE_TIME)//超过无敌时间,退出无敌状态,停止闪烁{_isInvincible=false;_isFadeAway=false;_spriteRender.color=newColor(1,1,1,_maxAlpha);_invincibleTimer=0;}}privatevoid_Fade...
for (int i = 0; i < pressTimeA.Count; i++) { if (pressTimeA[i] < timer)//当前时间如果大于按下的时间的话,那么就调用人物移动的方法 { if (pressTimeA[i] < liftUpTimeA[i]) { Atime += Time.deltaTime; if (Atime < liftUpTimeA[i] - pressTimeA[i]) ...
private void onTimeup(Timer timer) { print("计时完成"); } /// 倒计时间隔 private void onCD(Timer timer) { print(timer.repeatCount - timer.currentCount); // 3, 2, 1 } /// 倒计时结束 private void onCDEnd(Timer timer) { print(timer.repeatCount - timer.currentCount); // 0 ...