123456789101112131415161718192021222324252627282930313233 |
- using System;
- namespace Mono.UI.Core
- {
- public class CustomTimer
- {
- public float TargetTime;
- public float CurTime;
- public Action Action;
- public bool IsOver;
- public void Update(float time)
- {
- CurTime += time;
- if (CurTime >= TargetTime)
- {
- IsOver = true;
- Action?.Invoke();
- TimeComponent.Instance.Rec(this);
- }
- }
- public void CustomInit(float targetTime, Action action)
- {
- CurTime = 0;
- TargetTime = targetTime;
- Action = action;
- IsOver = false;
- }
- }
- }
|