mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 21:02:54 +08:00
Simplify HitObjectLifetimeEntry logic a bit
This commit is contained in:
parent
003553aba3
commit
b87446a577
@ -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`).
|
// This method is called even if `start == LifetimeStart` when `KeepAlive` is true (necessary to update `realLifetimeStart`).
|
||||||
protected override void SetLifetimeStart(double start)
|
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;
|
realLifetimeStart = start;
|
||||||
base.SetLifetimeStart(start);
|
if (!keepAlive)
|
||||||
|
base.SetLifetimeStart(start);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void SetLifetimeEnd(double end)
|
protected override void SetLifetimeEnd(double end)
|
||||||
{
|
{
|
||||||
realLifetimeEnd = end;
|
realLifetimeEnd = end;
|
||||||
base.SetLifetimeEnd(end);
|
if (!keepAlive)
|
||||||
}
|
base.SetLifetimeEnd(end);
|
||||||
|
|
||||||
protected override void SetLifetime(double start, double end)
|
|
||||||
{
|
|
||||||
if (keepAlive)
|
|
||||||
base.SetLifetime(double.MinValue, double.MaxValue);
|
|
||||||
else
|
|
||||||
base.SetLifetime(start, end);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool keepAlive;
|
private bool keepAlive;
|
||||||
@ -77,7 +70,10 @@ namespace osu.Game.Rulesets.Objects
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
keepAlive = value;
|
keepAlive = value;
|
||||||
SetLifetime(realLifetimeStart, realLifetimeEnd);
|
if (keepAlive)
|
||||||
|
SetLifetime(double.MinValue, double.MaxValue);
|
||||||
|
else
|
||||||
|
SetLifetime(realLifetimeStart, realLifetimeEnd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user