From ae1c65c38dfd48e57be107f31da80ac7be62db5f Mon Sep 17 00:00:00 2001 From: Henry Lin Date: Tue, 8 Mar 2022 12:07:10 +0800 Subject: [PATCH] Add xmldoc --- osu.Game.Rulesets.Osu/Mods/OsuModRandom.cs | 39 ++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModRandom.cs b/osu.Game.Rulesets.Osu/Mods/OsuModRandom.cs index 76183fe0aa..babc4311ee 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModRandom.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModRandom.cs @@ -50,6 +50,11 @@ namespace osu.Game.Rulesets.Osu.Mods applyRandomisation(hitObjects, randomObjects); } + /// + /// Randomise the position of each hit object and return a list of s describing how each hit object should be placed. + /// + /// A list of s to have their positions randomised. + /// A list of s describing how each hit object should be placed. private List randomiseObjects(IEnumerable hitObjects) { var randomObjects = new List(); @@ -89,6 +94,11 @@ namespace osu.Game.Rulesets.Osu.Mods return randomObjects; } + /// + /// Reposition the hit objects according to the information in . + /// + /// The hit objects to be repositioned. + /// A list of describing how each hit object should be placed. private void applyRandomisation(IReadOnlyList hitObjects, IReadOnlyList randomObjects) { RandomObjectInfo previous = null; @@ -141,6 +151,12 @@ namespace osu.Game.Rulesets.Osu.Mods } } + /// + /// Get the absolute angle of a vector pointing from the previous hit object to the one denoted by . + /// + /// A list of all hit objects in the beatmap. + /// The hit object that the vector should point to. + /// The absolute angle of the aforementioned vector. private float getAbsoluteAngle(IReadOnlyList hitObjects, int hitObjectIndex) { if (hitObjectIndex < 0) return 0; @@ -151,9 +167,11 @@ namespace osu.Game.Rulesets.Osu.Mods } /// - /// Returns the final position of the hit object + /// Compute the randomised position of a hit object while attempting to keep it inside the playfield. /// - /// Final position of the hit object + /// The direction of movement of the player's cursor before it starts to approach the current hit object. + /// The representing the hit object immediately preceding the current one. + /// The representing the hit object to have the randomised position computed for. private void computeRandomisedPosition(float previousAbsoluteAngle, RandomObjectInfo previous, RandomObjectInfo current) { float absoluteAngle = previousAbsoluteAngle + current.RelativeAngle; @@ -315,7 +333,24 @@ namespace osu.Game.Rulesets.Osu.Mods private class RandomObjectInfo { + /// + /// The jump angle from the previous hit object to this one, relative to the previous hit object's jump angle. + /// + /// + /// of the first hit object in a beatmap represents the absolute angle from playfield center to the object. + /// + /// + /// If is 0, the player's cursor doesn't need to change its direction of movement when passing + /// the previous object to reach this one. + /// public float RelativeAngle { get; set; } + + /// + /// The jump distance from the previous hit object to this one. + /// + /// + /// of the first hit object in a beatmap is relative to the playfield center. + /// public float Distance { get; set; } public Vector2 PositionOriginal { get; }