1.Unity定时器受TimeScale影响
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public enum ETimerType
{
OneShot,
Repeated,
}
public class Timer
{
//当前这个定时器对象的唯一标识符
public string key;
//超时时间
public float time;
//当前数到的时间
public float curTime;
//定时器的类型
public ETimerType type;
//回调函数
public Action action;
//
public bool isDead;
public Timer(string key, float time, ETimerType type, Action action)
{
curTime = 0;
this.key = key;
this.time = time;
this.type = type;
this.action = action;
isDead = false;
}
}
public class TimerMgr
{
static TimerMgr sInstance = null;
public static TimerMgr Instance
{
get
{
if (sInstance == null)
{