public void FrameToDo(int frames, Action <object> action, object parameter) { ToDoEvent to = new ToDoEvent(); to.level = frames; to.DoEvent = action; to.parameter = parameter; frame_events.Add(to); }
public void DoWait(float time, Action <object> action, object parameter) { if (time_events.Count == 0) { if (action != null) { action(parameter); } } ToDoEvent to = new ToDoEvent(); to.time = time; to.DoEvent = action; to.parameter = parameter; time_events.Add(to); }
/// <summary> /// 委托某个事件在多少毫秒后执行 /// </summary> /// <param name="time"></param> /// <param name="action"></param> /// <param name="parameter"></param> public void ToDo(float time, Action <object> action, object parameter) { for (int i = 0; i < time_events.Count; i++) { if (action == time_events[i].DoEvent) { time_events[i].time = time; return; } } ToDoEvent to = new ToDoEvent(); to.time = time; to.DoEvent = action; to.parameter = parameter; time_events.Add(to); }
public void ToDo(string key, Action <object> action, object parameter, int level = 0) { ToDoEvent to = new ToDoEvent(); to.key = key; to.DoEvent = action; to.parameter = parameter; to.level = level; for (int i = 0; i < key_events.Count; i++) { if (key_events[i].key == key) { if (to.level > key_events[i].level) { key_events[i] = to; } return; } } key_events.Add(to); }