public BlendHueData(GroupID gID, LightID lID, LightData fromData, LightData toData, float transitionTime) { _gID = gID; _lID = lID; _fromData = fromData; _toData = toData; _transitionTime = transitionTime; _timeStamp = Time.time; }
public LightEventArgs(GroupID g, LightID l, LightTypes lt, LightData d) { Group = g; Light = l; LightType = lt; Data = d; }
public LightTriggeredEventArgs(GroupID g, LightID l, float w) { Group = g; Light = l; Weight = w; }
//finds the GroupID and LightID of a light with the given channel # //returns false if it doesnt find a compatible light in any of the groups bool FindLight(int channel, LightTypes lightType, ref GroupID gID, ref LightID lID) { for (int i = 0; i < LightGroups.Length; i++) { LightGroupConfig g = LightGroups[i]; for (int j = 0; j < g.Lights.Length; j++) { LightConfig l = g.Lights[j]; if ((l.Channel == channel) && (l.LightType == lightType)) { gID = g.Group; lID = (LightID)j; return true; } } } return false; }
LightConfig FindLightConfig(GroupID gId, LightID lId) { for (int i = 0; i < LightGroups.Length; i++) { LightGroupConfig g = LightGroups[i]; if (g.Group == gId) { for (int j = 0; j < g.Lights.Length; j++) { if (j == (int)lId) return g.Lights[j]; } } } return null; }
//a way to set the value of any light in the system, regardless of type (Hue, LightJams, whatevs) public void SetLight(GroupID gID, LightID lID, float intensity, Color color = default(Color), float transitionTime = 0.0f) { LightConfig lc = FindLightConfig(gID, lID); if (lc != null) lc.Set(color, intensity, transitionTime); }
public void SendLightTriggeredEvent(GroupID g, LightID l, float weight) { if (OnLightEffectTriggered != null) OnLightEffectTriggered(this, new LightTriggeredEventArgs(g, l, weight)); }
public void SendHueEvent(GroupID gID, LightID lID, LightData newData) { if(OnLightChanged != null) OnLightChanged(this, new LightEventArgs(gID, lID, LightTypes.Hue, newData)); }
public bool IsLightJamsLight(GroupID g, LightID l) { LightConfig lConfig = FindLightConfig(g, l); if (lConfig != null) return lConfig.LightType == LightTypes.LightJams; return false; }
//get latency for the given light. Meaning this is how long it takes to set a value, and have it appear on the lights. public float GetLatency(GroupID gID, LightID lID) { LightConfig lc = FindLightConfig(gID, lID); if (lc != null) { if (lc.LightType == LightTypes.Hue) return HueMessenger.Instance.GetCurLatency(); else return LightJamsMgr.Instance.GetCurLatency(); } return 0.0f; }