mirror of
https://github.com/osukey/osukey.git
synced 2025-05-07 14:47:22 +09:00
Improve triangles distribution
This commit is contained in:
parent
c7dc6db124
commit
f27a5f977d
@ -187,13 +187,27 @@ namespace osu.Game.Graphics.Backgrounds
|
|||||||
{
|
{
|
||||||
TriangleParticle particle = CreateTriangle();
|
TriangleParticle particle = CreateTriangle();
|
||||||
|
|
||||||
particle.Position = new Vector2(nextRandom(), randomY ? nextRandom() : 1);
|
particle.Position = getRandomPosition(randomY, particle.Scale);
|
||||||
particle.ColourShade = nextRandom();
|
particle.ColourShade = nextRandom();
|
||||||
particle.Colour = CreateTriangleShade(particle.ColourShade);
|
particle.Colour = CreateTriangleShade(particle.ColourShade);
|
||||||
|
|
||||||
return particle;
|
return particle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Vector2 getRandomPosition(bool randomY, float scale)
|
||||||
|
{
|
||||||
|
float y = 1;
|
||||||
|
|
||||||
|
if (randomY)
|
||||||
|
{
|
||||||
|
// since triangles are drawn from the top - allow them to be positioned a bit above the screen
|
||||||
|
float maxOffset = triangle_size * scale * 0.866f / DrawHeight;
|
||||||
|
y = Interpolation.ValueAt(nextRandom(), -maxOffset, 1f, 0f, 1f);
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Vector2(nextRandom(), y);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a triangle particle with a random scale.
|
/// Creates a triangle particle with a random scale.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user