using System;
using System.Threading.Tasks;

namespace WS
{
    ///<summary>时间实体</summary>
    public class TimerEntity : WSComponent
    {
        ///<summary>等待时间</summary>
        public float WaitTime;
        ///<summary>使用时间</summary>
        public float UseTime;
        ///<summary>计时回调</summary>
        public Action OnCallback;
        ///<summary>计时回调</summary>
        public Action<float> OnUpdate;
        ///<summary>是否暂停</summary>
        public bool IsPause;
        ///<summary>是否循环</summary>
        public bool IsLoop;
        ///<summary>线程代理</summary>
        public TaskCompletionSource<bool> Tcs;

        public override void Dispose()
        {
            base.Dispose();
            WaitTime = 0;
            UseTime = 0;
            OnCallback = null;
            OnUpdate = null;
            IsPause = false;
            IsLoop = false;
            Tcs = null;
        }
    }
}
