mirror of
https://github.com/osukey/osukey.git
synced 2025-08-03 14:46:38 +09:00
Make RandomSeed a property, not a bindable
This commit is contained in:
@ -33,7 +33,7 @@ namespace osu.Game.Rulesets.Catch.Objects
|
||||
|
||||
private Color4 getBananaColour()
|
||||
{
|
||||
switch (StatelessRNG.NextInt(3, RandomSeed.Value))
|
||||
switch (StatelessRNG.NextInt(3, RandomSeed))
|
||||
{
|
||||
default:
|
||||
return new Color4(255, 240, 0, 255);
|
||||
|
@ -99,9 +99,9 @@ namespace osu.Game.Rulesets.Catch.Objects
|
||||
|
||||
/// <summary>
|
||||
/// The seed value used for visual randomness such as fruit rotation.
|
||||
/// By default, <see cref="HitObject.StartTime"/> truncated to an integer is used.
|
||||
/// The value is <see cref="HitObject.StartTime"/> truncated to an integer.
|
||||
/// </summary>
|
||||
public Bindable<int> RandomSeed = new Bindable<int>();
|
||||
public int RandomSeed => (int)StartTime;
|
||||
|
||||
protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty)
|
||||
{
|
||||
@ -117,10 +117,6 @@ namespace osu.Game.Rulesets.Catch.Objects
|
||||
protected CatchHitObject()
|
||||
{
|
||||
XBindable.BindValueChanged(x => originalX = x.NewValue - xOffset);
|
||||
StartTimeBindable.BindValueChanged(change =>
|
||||
{
|
||||
RandomSeed.Value = (int)change.NewValue;
|
||||
}, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -24,11 +24,8 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
RandomSeed.BindValueChanged(_ =>
|
||||
{
|
||||
UpdateComboColour();
|
||||
UpdateInitialTransforms();
|
||||
});
|
||||
// start time affects the random seed which is used to determine the banana colour
|
||||
StartTimeBindable.BindValueChanged(_ => UpdateComboColour());
|
||||
}
|
||||
|
||||
protected override void UpdateInitialTransforms()
|
||||
|
@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
||||
|
||||
protected override float SamplePlaybackPosition => HitObject.X / CatchPlayfield.WIDTH;
|
||||
|
||||
public Bindable<int> RandomSeed = new Bindable<int>();
|
||||
public int RandomSeed => HitObject?.RandomSeed ?? 0;
|
||||
|
||||
protected DrawableCatchHitObject([CanBeNull] CatchHitObject hitObject)
|
||||
: base(hitObject)
|
||||
@ -32,14 +32,13 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
||||
/// <summary>
|
||||
/// Get a random number in range [0,1) based on seed <see cref="RandomSeed"/>.
|
||||
/// </summary>
|
||||
public float RandomSingle(int series) => StatelessRNG.NextSingle(RandomSeed.Value, series);
|
||||
public float RandomSingle(int series) => StatelessRNG.NextSingle(RandomSeed, series);
|
||||
|
||||
protected override void OnApply()
|
||||
{
|
||||
base.OnApply();
|
||||
|
||||
XBindable.BindTo(HitObject.XBindable);
|
||||
RandomSeed.BindTo(HitObject.RandomSeed);
|
||||
}
|
||||
|
||||
protected override void OnFree()
|
||||
@ -47,7 +46,6 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
||||
base.OnFree();
|
||||
|
||||
XBindable.UnbindFrom(HitObject.XBindable);
|
||||
RandomSeed.UnbindFrom(HitObject.RandomSeed);
|
||||
}
|
||||
|
||||
public Func<CatchHitObject, bool> CheckPosition;
|
||||
|
@ -36,11 +36,13 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawables
|
||||
|
||||
VisualRepresentation.BindValueChanged(_ => updatePiece());
|
||||
HyperDash.BindValueChanged(_ => updatePiece(), true);
|
||||
}
|
||||
|
||||
RandomSeed.BindValueChanged(_ =>
|
||||
{
|
||||
ScaleContainer.Rotation = (RandomSingle(1) - 0.5f) * 40;
|
||||
}, true);
|
||||
protected override void UpdateInitialTransforms()
|
||||
{
|
||||
base.UpdateInitialTransforms();
|
||||
|
||||
ScaleContainer.Rotation = (RandomSingle(1) - 0.5f) * 40;
|
||||
}
|
||||
|
||||
private void updatePiece()
|
||||
|
Reference in New Issue
Block a user