public bool RegisterEvent(TimelineDelegate action, Dictionary <string, object> data, double timeOut, double fromTime = -1) { fromTime = fromTime == -1 ? now : fromTime; double timestamp = fromTime + timeOut; if (timestamp < now) { Console.WriteLine("WARNING: Timeline Event was set to trigger before now."); } TimelineEvent e = new TimelineEvent(action, data, timestamp); bool done = false; for (int i = 0; i < timeline.Count; i++) { if (timestamp < timeline[i].timestamp) { timeline.Insert(i, e); done = true; break; } } if (!done) { timeline.Add(e); done = true; } Console.WriteLine(ToString()); return(done); }
public TimelineEvent(TimelineDelegate action, Dictionary <string, object> data, double timestamp) { this.action = action; this.timestamp = timestamp; this.data = data; }