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) => 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) private CaughtObject getCaughtObject(PalpableCatchHitObject source)
{ {

View File

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