using System;
using System.Collections.Generic;
using AlicizaX.Runtime;
using UnityEngine;
namespace AlicizaX.Timer.Runtime
{
///
/// 计时器组件。
///
[DisallowMultipleComponent]
[AddComponentMenu("Game Framework/Timer")]
[UnityEngine.Scripting.Preserve]
public class TimerComponent : GameFrameworkComponent
{
ITimerManager _timerManager;
protected override void Awake()
{
ImplementationComponentType = Utility.Assembly.GetType(componentType);
InterfaceComponentType = typeof(ITimerManager);
base.Awake();
_timerManager = SysModuleCenter.GetModule();
if (_timerManager == null)
{
Log.Fatal("Timer manager is invalid.");
return;
}
}
///
/// 添加一个定时调用的任务
///
/// 间隔时间(以秒为单位)
/// 重复次数(0 表示无限重复)
/// 要执行的回调函数
/// 回调函数的参数(可选)
public void Add(float interval, int repeat, Action