public bool Update() { var currentTime = Time.time; var alpha = Mathf.Max((1f - ((currentTime - _time) / Duration)), 0f); if (alpha < 0 || alpha > 1) { alpha = 0; } if (RainbowUtils.IsRainbow(Player.Data.ColorId) & !CustomGameOptions.AnonymousFootPrint) { Color = RainbowUtils.Rainbow; } Color = new Color(Color.r, Color.g, Color.b, alpha); _spriteRenderer.color = Color; if (_time + (int)Duration < currentTime) { Destroy(); return(true); } return(false); }
public bool Update() { var currentTime = Time.time; var alpha = Mathf.Max(1f - (currentTime - _time) / Duration, 0f); if (alpha < 0 || alpha > 1) { alpha = 0; } if (RainbowUtils.IsRainbow(Player.Data.ColorId) & !Grey) { Color = RainbowUtils.Rainbow; } else if (Grey) { Color = new Color(0.2f, 0.2f, 0.2f, 1f); } else { Color = Palette.PlayerColors[Player.Data.ColorId]; } Color = new Color(Color.r, Color.g, Color.b, alpha); _spriteRenderer.color = Color; if (_time + (int)Duration < currentTime) { Destroy(); return(true); } return(false); }
// If the R, G, or B values change, use this // code to update the HSV values and invalidate // the color wheel (so it updates the pointers). // Check the isInUpdate flag to avoid recursive events // when you update the NumericUpdownControls. private void HandleRGBScroll(object sender, ScrollEventArgs e) { _changeType = ChangeStyle.RGB; RGB = new DRColor.RGB(hsbRed.Value, hsbGreen.Value, hsbBlue.Value); SetHSV(new DRColor.HSV(RGB)); SetRGBLabels(RGB); this.Invalidate(); RainbowUtils.fillBoth(RGB); }
// If the H, S, or V values change, use this // code to update the RGB values and invalidate // the color wheel (so it updates the pointers). // Check the isInUpdate flag to avoid recursive events // when you update the NumericUpdownControls. private void HandleHSVScroll(object sender, ScrollEventArgs e) { _changeType = ChangeStyle.HSV; HSV = new DRColor.HSV(hsbHue.Value, hsbSaturation.Value, hsbBrightness.Value); SetRGB(new DRColor.RGB(HSV)); SetHSVLabels(HSV); this.Invalidate(); RainbowUtils.fillBoth(RGB); }
private void colorWheel_Changed(object sender, ColorChangedEventArgs e) { if (e.RGB == null || e.HSV == null) { return; } SetRGB(e.RGB); SetHSV(e.HSV); RainbowUtils.fillBoth(e.RGB); }
public static bool Prefix([HarmonyArgument(0)] int colorId, [HarmonyArgument(1)] Renderer rend) { var r = rend.gameObject.GetComponent <RainbowBehaviour>(); if (r == null) { r = rend.gameObject.AddComponent <RainbowBehaviour>(); } r.AddRend(rend, colorId); return(!RainbowUtils.IsRainbow(colorId)); }
public void Update() { if (Renderer == null) { return; } if (RainbowUtils.IsRainbow(Id)) { RainbowUtils.SetRainbow(Renderer); } }
public void Update() { if (Renderer == null) { return; } if (RainbowUtils.IsRainbow(Id)) { RainbowUtils.SetRainbow(Renderer); } /*else if (RainbowUtils.IsGalaxy(Id)) * { * RainbowUtils.SetGalaxy(Renderer); * } * else if (RainbowUtils.IsFire(Id)) * { * RainbowUtils.SetFire(Renderer); * }*/ }
public LedRestClient(string url, string port, int ledCount) { _URLWithPort = $"http://{url}:{port}"; _HttpClient = new RestClient(_URLWithPort); _Buffer = RainbowUtils.createEmptyArray(ledCount); }