1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 23:05:37 +08:00

Clamp fruit to plate

This commit is contained in:
Dean Herbert 2018-01-04 17:51:34 +09:00
parent 5125abf681
commit 0bbc15d24a

View File

@ -174,13 +174,15 @@ namespace osu.Game.Rulesets.Catch.UI
while (caughtFruit.Any(f =>
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;
fruit.X += (RNG.NextSingle() - 0.5f) * 2 * diff;
fruit.Y -= RNG.NextSingle() * diff;
}
fruit.X = MathHelper.Clamp(fruit.X, -CATCHER_SIZE / 2, CATCHER_SIZE / 2);
caughtFruit.Add(fruit);
var catchObject = (CatchHitObject)fruit.HitObject;