1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 14:17:26 +08:00

Reorganise functions to order more logically (hitcircle before slider methods)

This commit is contained in:
Dean Herbert 2021-07-13 19:37:17 +09:00
parent 6b663037e4
commit 4314946e10

View File

@ -142,6 +142,23 @@ namespace osu.Game.Rulesets.Osu.Mods
current.PositionRandomised = previous.EndPositionRandomised + posRelativeToPrev; current.PositionRandomised = previous.EndPositionRandomised + posRelativeToPrev;
} }
/// <summary>
/// Move the randomised position of a hit circle so that it fits inside the playfield.
/// </summary>
/// <returns>The deviation from the original randomised position in order to fit within the playfield.</returns>
private Vector2 clampHitCircleToPlayfield(HitCircle circle, RandomObjectInfo objectInfo)
{
var previousPosition = objectInfo.PositionRandomised;
objectInfo.EndPositionRandomised = objectInfo.PositionRandomised = clampToPlayfieldWithPadding(
objectInfo.PositionRandomised,
(float)circle.Radius
);
circle.Position = objectInfo.PositionRandomised;
return objectInfo.PositionRandomised - previousPosition;
}
/// <summary> /// <summary>
/// Moves the <see cref="Slider"/> and all necessary nested <see cref="OsuHitObject"/>s into the <see cref="OsuPlayfield"/> if they aren't already. /// Moves the <see cref="Slider"/> and all necessary nested <see cref="OsuHitObject"/>s into the <see cref="OsuPlayfield"/> if they aren't already.
/// </summary> /// </summary>
@ -254,23 +271,6 @@ namespace osu.Game.Rulesets.Osu.Mods
} }
} }
/// <summary>
/// Move the randomised position of a hit circle so that it fits inside the playfield.
/// </summary>
/// <returns>The deviation from the original randomised position in order to fit within the playfield.</returns>
private Vector2 clampHitCircleToPlayfield(HitCircle circle, RandomObjectInfo objectInfo)
{
var previousPosition = objectInfo.PositionRandomised;
objectInfo.EndPositionRandomised = objectInfo.PositionRandomised = clampToPlayfieldWithPadding(
objectInfo.PositionRandomised,
(float)circle.Radius
);
circle.Position = objectInfo.PositionRandomised;
return objectInfo.PositionRandomised - previousPosition;
}
/// <summary> /// <summary>
/// Clamp a position to playfield, keeping a specified distance from the edges. /// Clamp a position to playfield, keeping a specified distance from the edges.
/// </summary> /// </summary>