mirror of https://github.com/ppy/osu
Make random generator a field to avoid passing around internally
This commit is contained in:
parent
6181b1ac92
commit
6ca9b37c28
|
@ -40,6 +40,8 @@ public class OsuModRandom : ModRandom, IApplicableToBeatmap
|
||||||
|
|
||||||
private static readonly float playfield_diagonal = OsuPlayfield.BASE_SIZE.LengthFast;
|
private static readonly float playfield_diagonal = OsuPlayfield.BASE_SIZE.LengthFast;
|
||||||
|
|
||||||
|
private Random rng;
|
||||||
|
|
||||||
[SettingSource("Seed", "Use a custom seed instead of a random one", SettingControlType = typeof(OsuModRandomSettingsControl))]
|
[SettingSource("Seed", "Use a custom seed instead of a random one", SettingControlType = typeof(OsuModRandomSettingsControl))]
|
||||||
public Bindable<int?> Seed { get; } = new Bindable<int?>
|
public Bindable<int?> Seed { get; } = new Bindable<int?>
|
||||||
{
|
{
|
||||||
|
@ -56,7 +58,7 @@ public void ApplyToBeatmap(IBeatmap beatmap)
|
||||||
|
|
||||||
Seed.Value ??= RNG.Next();
|
Seed.Value ??= RNG.Next();
|
||||||
|
|
||||||
var rng = new Random((int)Seed.Value);
|
rng = new Random((int)Seed.Value);
|
||||||
|
|
||||||
RandomObjectInfo prevObjectInfo = null;
|
RandomObjectInfo prevObjectInfo = null;
|
||||||
|
|
||||||
|
@ -83,9 +85,7 @@ public void ApplyToBeatmap(IBeatmap beatmap)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
applyRandomisation(
|
applyRandomisation(rateOfChangeMultiplier,
|
||||||
rng,
|
|
||||||
rateOfChangeMultiplier,
|
|
||||||
prevObjectInfo,
|
prevObjectInfo,
|
||||||
distanceToPrev,
|
distanceToPrev,
|
||||||
currentObjectInfo
|
currentObjectInfo
|
||||||
|
|
Loading…
Reference in New Issue