public void AddEvent(float time, GameEvent.Func f) { if (time > 0f) { StartCoroutine(DelayInvoke(time, f)); } else { f(); } }
IEnumerator DelayInvoke(float time, GameEvent.Func f) { yield return(new WaitForSeconds(time)); try { f(); } catch (KeyNotFoundException e) { Debug.LogError("buff(" + id + ") " + e.Message); Debug.LogError(e.StackTrace); MessageBox.Show("buff param error", "buff(" + id + ") " + e.Message); } }
public void AddEvent(float time, GameEvent.Func f, int count) { StartCoroutine(DelayInvokeRepeating(time, f, count)); }