diff --git a/osu.Game/Graphics/Backgrounds/Triangles.cs b/osu.Game/Graphics/Backgrounds/Triangles.cs
index af492bacc9..0eb5e90d3e 100644
--- a/osu.Game/Graphics/Backgrounds/Triangles.cs
+++ b/osu.Game/Graphics/Backgrounds/Triangles.cs
@@ -176,8 +176,7 @@ namespace osu.Game.Graphics.Backgrounds
TriangleParticle particle = CreateTriangle();
particle.Position = new Vector2(RNG.NextSingle(), randomY ? RNG.NextSingle() : 1);
- particle.ColourShade = RNG.NextSingle();
- particle.Colour = CreateTriangleShade(particle.ColourShade);
+ particle.UpdateColour(colourDark, colourLight);
return particle;
}
@@ -199,18 +198,12 @@ namespace osu.Game.Graphics.Backgrounds
return new TriangleParticle { Scale = scale };
}
- ///
- /// Creates a shade of colour for the triangles.
- ///
- /// The colour.
- protected virtual Color4 CreateTriangleShade(float shade) => Interpolation.ValueAt(shade, colourDark, colourLight, 0, 1);
-
private void updateColours()
{
for (int i = 0; i < parts.Count; i++)
{
TriangleParticle newParticle = parts[i];
- newParticle.Colour = CreateTriangleShade(newParticle.ColourShade);
+ newParticle.UpdateColour(colourDark, colourLight);
parts[i] = newParticle;
}
}
@@ -293,7 +286,7 @@ namespace osu.Game.Graphics.Backgrounds
}
}
- protected struct TriangleParticle : IComparable
+ protected class TriangleParticle : IComparable
{
///
/// The position of the top vertex of the triangle.
@@ -304,7 +297,7 @@ namespace osu.Game.Graphics.Backgrounds
/// The colour shade of the triangle.
/// This is needed for colour recalculation of visible triangles when or is changed.
///
- public float ColourShade;
+ private readonly float colourShade = RNG.NextSingle();
///
/// The colour of the triangle.
@@ -316,6 +309,11 @@ namespace osu.Game.Graphics.Backgrounds
///
public float Scale;
+ public void UpdateColour(Color4 colourDark, Color4 colourLight)
+ {
+ Colour = Interpolation.ValueAt(colourShade, colourDark, colourLight, 0, 1);
+ }
+
///
/// Compares two s. This is a reverse comparer because when the
/// triangles are added to the particles list, they should be drawn from largest to smallest