IEnumerator SendDelayedUpdateEvent(float delayTime, HueEventArgs eventData) { yield return new WaitForSeconds(delayTime); if (OnLightChanged != null) OnLightChanged(this, eventData); }
void SendEvents(Light l, Color prevColor, float prevFade) { //notify anyone who cares if ((OnLightCommandSent != null) || (OnLightChanged != null)) { float eventFade = l.fade; if (!l.on) eventFade = 0.0f; HueEventArgs eventData = new HueEventArgs(l.id, l.color, eventFade, l.transitionTime, prevColor, prevFade); 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)); } }
private void _hue_StatusUpdate(object sender, HueEventArgs e) { Status = e.Status; }