vampire-like/Assets/Plugins/TimerModule/Runtime/TimerTask.cs

76 lines
1.7 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
namespace SepCore.Timer
{
/// <summary>
/// 定时任务描述。
/// </summary>
public struct TimerTask
{
public TimerTask(float delay, float interval, int repeatCount, Action callback, object owner = null,
TimerTimeMode timeMode = TimerTimeMode.Scaled)
{
Delay = delay;
Interval = interval;
RepeatCount = repeatCount;
Callback = callback;
Owner = owner;
TimeMode = timeMode;
}
/// <summary>
/// 获取或设置首次触发前的延迟时间(秒)。
/// </summary>
public float Delay
{
get;
set;
}
/// <summary>
/// 获取或设置循环触发间隔(秒)。一次性任务会忽略该值。
/// </summary>
public float Interval
{
get;
set;
}
/// <summary>
/// 获取或设置触发次数。1 表示一次性负数表示无限循环0 表示不创建任务。
/// </summary>
public int RepeatCount
{
get;
set;
}
/// <summary>
/// 获取或设置任务回调。
/// </summary>
public Action Callback
{
get;
set;
}
/// <summary>
/// 获取或设置任务归属对象,用于批量取消。
/// </summary>
public object Owner
{
get;
set;
}
/// <summary>
/// 获取或设置任务时间源。
/// </summary>
public TimerTimeMode TimeMode
{
get;
set;
}
}
}