1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 10:18:22 +08:00

Simplify HitObjectLifetimeEntry logic a bit

This commit is contained in:
ekrctb 2021-04-27 19:37:01 +09:00
parent 003553aba3
commit b87446a577

View File

@ -45,23 +45,16 @@ namespace osu.Game.Rulesets.Objects
// This method is called even if `start == LifetimeStart` when `KeepAlive` is true (necessary to update `realLifetimeStart`).
protected override void SetLifetimeStart(double start)
{
// This assignment cannot be done in `SetLifetime` because otherwise setting only `LifetimeStart` will make `realLifetimeEnd` to be lost.
realLifetimeStart = start;
base.SetLifetimeStart(start);
if (!keepAlive)
base.SetLifetimeStart(start);
}
protected override void SetLifetimeEnd(double end)
{
realLifetimeEnd = end;
base.SetLifetimeEnd(end);
}
protected override void SetLifetime(double start, double end)
{
if (keepAlive)
base.SetLifetime(double.MinValue, double.MaxValue);
else
base.SetLifetime(start, end);
if (!keepAlive)
base.SetLifetimeEnd(end);
}
private bool keepAlive;
@ -77,7 +70,10 @@ namespace osu.Game.Rulesets.Objects
return;
keepAlive = value;
SetLifetime(realLifetimeStart, realLifetimeEnd);
if (keepAlive)
SetLifetime(double.MinValue, double.MaxValue);
else
SetLifetime(realLifetimeStart, realLifetimeEnd);
}
}