/// <summary> /// Adds the given method to the periodic system. In most cases, you can ignore the return value. /// </summary> /// <param name="method">The method to execute. Must return a boolean to indicate whether to continue looping or abort the periodic event.</param> /// <param name="period">The speed at which this event should fire.</param> public static PeriodicEvent AddPeriodicEvent(Func <bool> method, double period = SYSTEM_INTERVAL) { var timerEvent = new PeriodicEvent(method, period); timerEvents.Add(timerEvent); return(timerEvent); }
/// <param name="period">How frequently this trigger should fire.</param> public PeriodicTrigger(float period) { this.actions = new List <T>(); this.timerEvent = new PeriodicEvent(Periodic, period); }
/// <summary> /// Shorthand in case you already have an existing PeriodicEvent to resume. /// </summary> public static void AddPeriodicEvent(PeriodicEvent timerEvent) { timerEvents.Add(timerEvent); }