mirror of
https://github.com/ppy/osu.git
synced 2025-01-21 19:52:55 +08:00
Clamp fruit to plate
This commit is contained in:
parent
5125abf681
commit
0bbc15d24a
@ -174,13 +174,15 @@ namespace osu.Game.Rulesets.Catch.UI
|
|||||||
|
|
||||||
while (caughtFruit.Any(f =>
|
while (caughtFruit.Any(f =>
|
||||||
f.LifetimeEnd == double.MaxValue &&
|
f.LifetimeEnd == double.MaxValue &&
|
||||||
Vector2Extensions.Distance(f.Position, fruit.Position) < (ourRadius + (theirRadius = (f.DrawSize.X / 2 * f.Scale.X))) / (allowance / 2)))
|
Vector2Extensions.Distance(f.Position, fruit.Position) < (ourRadius + (theirRadius = f.DrawSize.X / 2 * f.Scale.X)) / (allowance / 2)))
|
||||||
{
|
{
|
||||||
float diff = (ourRadius + theirRadius) / allowance;
|
float diff = (ourRadius + theirRadius) / allowance;
|
||||||
fruit.X += (RNG.NextSingle() - 0.5f) * 2 * diff;
|
fruit.X += (RNG.NextSingle() - 0.5f) * 2 * diff;
|
||||||
fruit.Y -= RNG.NextSingle() * diff;
|
fruit.Y -= RNG.NextSingle() * diff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fruit.X = MathHelper.Clamp(fruit.X, -CATCHER_SIZE / 2, CATCHER_SIZE / 2);
|
||||||
|
|
||||||
caughtFruit.Add(fruit);
|
caughtFruit.Add(fruit);
|
||||||
|
|
||||||
var catchObject = (CatchHitObject)fruit.HitObject;
|
var catchObject = (CatchHitObject)fruit.HitObject;
|
||||||
|
Loading…
Reference in New Issue
Block a user