public override void OnUpdate() { base.OnUpdate(); currentInvokeTime += Time.deltaTime * TimeScale; for (int i = 0; i < invokeList.Count; i++) { InvokeData data = invokeList [i]; if (currentInvokeTime - data.time >= data.delay) { if (data.isRepeat) { data.delay += data.repeatTime; } else { data.remove = true; } if (data.callback != null) { data.callback(); } } } invokeList.RemoveAll((o) => { return(o.remove); }); }
protected virtual void Update() { if (scriptDataList == null) { return; } currentInvokeTime += Time.deltaTime; scriptDataList.RemoveAll(o => o.script.enabled == false); for (int i = 0; i < scriptDataList.Count; i++) { for (int j = 0; j < scriptDataList [i].invokeList.Count; j++) { InvokeData data = scriptDataList [i].invokeList [j]; if (currentInvokeTime - data.time >= data.delay) { if (data.isRepeat) { data.delay += data.repeatTime; } else { data.remove = true; } if (data.callback != null) { data.callback(); } } } scriptDataList [i].invokeList.RemoveAll((o) => { return(o.remove); }); } scriptDataList.RemoveAll(o => o.invokeList == null || o.invokeList.Count == 0); if (scriptDataList.Count == 0) { this.enabled = false; } }