1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 09:32:55 +08:00

Use seeded RNG for catch explosion animation

The animation is always the same when a replay is rewound or a beatmap is played multiple times.
This commit is contained in:
ekrctb 2021-06-04 19:54:46 +09:00
parent 5512231bf4
commit 8e20f90ed5
3 changed files with 9 additions and 6 deletions

View File

@ -506,7 +506,7 @@ namespace osu.Game.Rulesets.Catch.UI
}
private void addLighting(CatchHitObject hitObject, float x, Color4 colour) =>
hitExplosionContainer.Add(new HitExplosionEntry(Time.Current, x, hitObject.Scale, colour));
hitExplosionContainer.Add(new HitExplosionEntry(Time.Current, x, hitObject.Scale, colour, hitObject.RandomSeed));
private CaughtObject getCaughtObject(PalpableCatchHitObject source)
{

View File

@ -7,6 +7,7 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Effects;
using osu.Framework.Utils;
using osu.Game.Rulesets.Objects.Pooling;
using osu.Game.Utils;
using osuTK;
using osuTK.Graphics;
@ -74,10 +75,10 @@ namespace osu.Game.Rulesets.Catch.UI
setColour(entry.ObjectColour);
using (BeginAbsoluteSequence(entry.LifetimeStart))
applyTransforms();
applyTransforms(entry.RNGSeed);
}
private void applyTransforms()
private void applyTransforms(int randomSeed)
{
ClearTransforms(true);
@ -90,8 +91,8 @@ namespace osu.Game.Rulesets.Catch.UI
.FadeOut(duration * 2);
const float angle_variangle = 15; // should be less than 45
directionalGlow1.Rotation = RNG.NextSingle(-angle_variangle, angle_variangle);
directionalGlow2.Rotation = RNG.NextSingle(-angle_variangle, angle_variangle);
directionalGlow1.Rotation = StatelessRNG.NextSingle(-angle_variangle, angle_variangle, randomSeed, 4);
directionalGlow2.Rotation = StatelessRNG.NextSingle(-angle_variangle, angle_variangle, randomSeed, 5);
this.FadeInFromZero(50).Then().FadeOut(duration, Easing.Out).Expire();
}

View File

@ -11,13 +11,15 @@ namespace osu.Game.Rulesets.Catch.UI
public readonly float Position;
public readonly float Scale;
public readonly Color4 ObjectColour;
public readonly int RNGSeed;
public HitExplosionEntry(double startTime, float position, float scale, Color4 objectColour)
public HitExplosionEntry(double startTime, float position, float scale, Color4 objectColour, int rngSeed)
{
LifetimeStart = startTime;
Position = position;
Scale = scale;
ObjectColour = objectColour;
RNGSeed = rngSeed;
}
}
}