private static readonly Color CompletedColor = new Color(0.0f, 0.8f, 0.27f); // green protected override void Draw(DrawingHandleScreen handle) { Span <float> x = stackalloc float[10]; Color color; var lerp = 1f - MathF.Abs(Progress); // for future bikeshedding purposes if (Progress >= 0f) { color = new Color( EndColor.R + (StartColor.R - EndColor.R) * Progress, EndColor.G + (StartColor.G - EndColor.G) * Progress, EndColor.B + (StartColor.B - EndColor.B) * Progress, EndColor.A); } else { var alpha = MathHelper.Clamp(0.5f * lerp, 0f, 0.5f); color = CompletedColor.WithAlpha(alpha); } _shader.SetParameter("progress", Progress); handle.UseShader(_shader); handle.DrawRect(PixelSizeBox, color); }
protected override void Draw(DrawingHandleBase handle, OverlaySpace currentSpace) { handle.UseShader(_shader); var percentComplete = (float)((_gameTiming.CurTime.TotalMilliseconds - _startTime) / lastsFor); _shader?.SetParameter("percentComplete", percentComplete); var screenSpaceHandle = handle as DrawingHandleScreen; var screenSize = UIBox2.FromDimensions((0, 0), _displayManager.ScreenSize); if (_screenshotTexture != null) { screenSpaceHandle?.DrawTextureRect(_screenshotTexture, screenSize); } }
protected override void Draw(DrawingHandleScreen handle) { Color color; var lerp = 1f - Math.Abs(Progress); // for future bikeshedding purposes if (Progress >= 0f) { var hue = (5f / 18f) * lerp; color = Color.FromHsv((hue, 0.75f, 0.75f, 0.50f)); } else { var alpha = Math.Clamp(0.5f * lerp, 0f, 0.5f); color = new Color(1f, 1f, 1f, alpha); } _shader.SetParameter("progress", Progress); handle.UseShader(_shader); handle.DrawRect(PixelSizeBox, color); }
public SingularityOverlay() { IoCManager.InjectDependencies(this); _shader = _prototypeManager.Index <ShaderPrototype>("Singularity").Instance().Duplicate(); _shader.SetParameter("maxDistance", MaxDistance * EyeManager.PixelsPerMeter); }