public void SendColor(Color col, string name = null, LocDepth depth = LocDepth.all, LocHorizontal horizontal = LocHorizontal.all, LocVertical vertical = LocVertical.all) { string color = "#" + ColorUtility.ToHtmlStringRGB(col).ToLower(); int brightness = Mathf.RoundToInt(col.a * 255); SendColor(color, brightness, name, depth, horizontal, vertical); }
public void SendColor(string color, int brightness = 100, string name = null, LocDepth depth = LocDepth.all, LocHorizontal horizontal = LocHorizontal.all, LocVertical vertical = LocVertical.all) { color = color.ToLower(); if (brightness < 0 || brightness > 255) { return; } if (!CheckStringColour(color)) { return; } LightCommand command = new LightCommand { action = "lightCommand", color = color, brightness = brightness, id = name, location = new Location() { vertical = vertical, horizontal = horizontal, depth = depth } }; MagicRoomManager.instance.Logger.AddToLogNewLine("Hue_allRoom", command.ToString()); StartCoroutine(SendCommand(command, (body) => { Debug.Log(body); })); }