public void SendLightChangedEvent(int channelNum, float val, Color color, bool isPar64) { LJEventArgs eventData = new LJEventArgs(channelNum, val, color, isPar64); if (OnLightCommandSent != null) OnLightCommandSent(this, eventData); //run co-routine to send out event for game after latency elapses (so visuals in-game don't trigger early) if (OnLightChanged != null) StartCoroutine(SendDelayedUpdateEvent(GetCurLatency(), eventData)); }
IEnumerator SendDelayedUpdateEvent(float delayTime, LJEventArgs eventData) { yield return new WaitForSeconds(delayTime); if (OnLightChanged != null) OnLightChanged(this, eventData); }