mirror of https://github.com/ppy/osu
Simplify math by making direction a float
This commit is contained in:
parent
dd5b90cf6c
commit
1c7ee2ca5f
|
@ -120,7 +120,7 @@ protected override void Blit(Action<TexturedVertex2D> vertexAction)
|
|||
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 @@ public ParticlePart(double availableDuration)
|
|||
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);
|
||||
|
|
Loading…
Reference in New Issue