private void Execute(MonoEventType id) { for (int i = 0, imax = triggers.Count; i < imax; ++i) { var ent = triggers[i]; if (ent.eventID == id && ent.callback != null) { ent.callback.Invoke(); } } }
/// <summary> /// 添加调用方法至相应生命周期中 /// </summary> /// <param name="type"></param> /// <param name="unityAction"></param> public void On(MonoEventType type, UnityAction unityAction) { switch (type) { case MonoEventType.Enable: On_Enable += unityAction; break; case MonoEventType.Update: On_Update += unityAction; break; case MonoEventType.FixedUpdate: On_FixedUpdate += unityAction; break; default: break; } }