Unity定时任务管理器,可添加、移除定时任务
using System.Collections.Generic;
using UnityEngine;
public delegate void TimeTaskDelegate();
/// <summary>
/// 定时任务管理器
/// </summary>
public class TimeManager :MonoBehaviour{
/// <summary>
/// 定时任务列表
/// </summary>
private List<TimeTask> taskList = new List<TimeTask>();
private static TimeManager _timeInstance;
public static TimeManager timeInstance
{
get
{
if (_timeInstance == null)
{
_timeInstance = FindObjectOfType(typeof(TimeManager)) as TimeManager;
if(_timeInstance == null)
{
GameObject obj = new GameObject("TimeManager");
obj.hideFlags = HideFl