Only drain health in non-break times

This commit is contained in:
smoogipoo 2019-12-25 14:49:17 +09:00
parent 977fb3d1bf
commit b348abcd07
2 changed files with 9 additions and 1 deletions

View File

@ -29,6 +29,11 @@ public class HealthProcessor : JudgementProcessor
/// </summary>
public readonly BindableDouble Health = new BindableDouble(1) { MinValue = 0, MaxValue = 1 };
/// <summary>
/// Whether gameplay is currently in a break.
/// </summary>
public readonly IBindable<bool> IsBreakTime = new Bindable<bool>();
/// <summary>
/// Whether this ScoreProcessor has already triggered the failed state.
/// </summary>
@ -53,7 +58,8 @@ protected override void Update()
{
base.Update();
Health.Value -= drainRate * Time.Elapsed;
if (!IsBreakTime.Value)
Health.Value -= drainRate * Time.Elapsed;
}
protected override void ApplyResultInternal(JudgementResult result)

View File

@ -272,6 +272,8 @@ private void addOverlayComponents(Container target, WorkingBeatmap working)
DrawableRuleset.Overlays.Add(ScoreProcessor);
DrawableRuleset.Overlays.Add(HealthProcessor);
HealthProcessor.IsBreakTime.BindTo(BreakOverlay.IsBreakTime);
}
private void updatePauseOnFocusLostState() =>