コード例 #1
0
        public static FunctionTimer Create(Action action, float timer, string functionName, bool useUnscaledDeltaTime, bool stopAllWithSameName)
        {
            InitIfNeeded();

            if (stopAllWithSameName)
            {
                StopAllTimersWithName(functionName);
            }

            GameObject    obj       = new GameObject("FunctionTimer Object " + functionName, typeof(MonoBehaviourHook));
            FunctionTimer funcTimer = new FunctionTimer(obj, action, timer, functionName, useUnscaledDeltaTime);

            obj.GetComponent <MonoBehaviourHook>().OnUpdate = funcTimer.Update;

            timerList.Add(funcTimer);

            return(funcTimer);
        }
コード例 #2
0
 public static void RemoveTimer(FunctionTimer funcTimer)
 {
     InitIfNeeded();
     timerList.Remove(funcTimer);
 }