mirror of https://github.com/ppy/osu
Fix particles not spawning if `Time.Current` is negative
This commit is contained in:
parent
761da45f6a
commit
d5a10e9221
|
@ -49,11 +49,7 @@ protected override void Update()
|
||||||
{
|
{
|
||||||
base.Update();
|
base.Update();
|
||||||
|
|
||||||
// reset cooldown if the clock was rewound.
|
if (Active.Value && CanSpawnParticles && Math.Abs(Time.Current - lastParticleAdded) > cooldown)
|
||||||
// this can happen when seeking in replays.
|
|
||||||
if (lastParticleAdded > Time.Current) lastParticleAdded = 0;
|
|
||||||
|
|
||||||
if (Active.Value && CanSpawnParticles && Time.Current > lastParticleAdded + cooldown)
|
|
||||||
{
|
{
|
||||||
var newParticle = CreateParticle();
|
var newParticle = CreateParticle();
|
||||||
newParticle.StartTime = (float)Time.Current;
|
newParticle.StartTime = (float)Time.Current;
|
||||||
|
@ -112,9 +108,6 @@ protected override void Blit(Action<TexturedVertex2D> vertexAction)
|
||||||
{
|
{
|
||||||
foreach (var p in particles)
|
foreach (var p in particles)
|
||||||
{
|
{
|
||||||
// ignore particles that weren't initialized.
|
|
||||||
if (p.StartTime <= 0) continue;
|
|
||||||
|
|
||||||
var timeSinceStart = currentTime - p.StartTime;
|
var timeSinceStart = currentTime - p.StartTime;
|
||||||
|
|
||||||
// ignore particles from the future.
|
// ignore particles from the future.
|
||||||
|
|
Loading…
Reference in New Issue