1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-18 12:40:18 +08:00

Simplify math by making direction a float

This commit is contained in:
Dean Herbert
2020-11-19 18:46:19 +09:00
Unverified
parent dd5b90cf6c
commit 1c7ee2ca5f
+2 -2
View File
@@ -120,7 +120,7 @@ namespace osu.Game.Graphics
private readonly struct ParticlePart
{
private readonly double duration;
private readonly double direction;
private readonly float direction;
private readonly float distance;
public ParticlePart(double availableDuration)
@@ -135,7 +135,7 @@ namespace osu.Game.Graphics
public Vector2 PositionAtTime(double time)
{
var travelledDistance = distance * progressAtTime(time);
return new Vector2(0.5f) + travelledDistance * new Vector2((float)Math.Sin(direction), (float)Math.Cos(direction));
return new Vector2(0.5f) + travelledDistance * new Vector2(MathF.Sin(direction), MathF.Cos(direction));
}
private float progressAtTime(double time) => (float)Math.Clamp(time / duration, 0, 1);