Skip to content

Commit

Permalink
Fix health animation affecting failing tint
Browse files Browse the repository at this point in the history
  • Loading branch information
peppy committed Oct 6, 2023
1 parent 1a60e6d commit 58448d3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions osu.Game/Screens/Play/HUD/FailingLayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ public partial class FailingLayer : HealthDisplay
/// </summary>
public readonly Bindable<bool> ShowHealth = new Bindable<bool>();

protected override bool PlayInitialIncreaseAnimation => false;

private const float max_alpha = 0.4f;
private const int fade_time = 400;
private const float gradient_size = 0.2f;
Expand Down
7 changes: 6 additions & 1 deletion osu.Game/Screens/Play/HUD/HealthDisplay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ public abstract partial class HealthDisplay : CompositeDrawable
[Resolved]
protected HealthProcessor HealthProcessor { get; private set; } = null!;

protected virtual bool PlayInitialIncreaseAnimation => true;

public Bindable<double> Current { get; } = new BindableDouble
{
MinValue = 0,
Expand Down Expand Up @@ -74,7 +76,10 @@ protected override void LoadComplete()
// this probably shouldn't be operating on `this.`
showHealthBar.BindValueChanged(healthBar => this.FadeTo(healthBar.NewValue ? 1 : 0, HUDOverlay.FADE_DURATION, HUDOverlay.FADE_EASING), true);

startInitialAnimation();
if (PlayInitialIncreaseAnimation)
startInitialAnimation();
else
Current.Value = 1;
}

private void startInitialAnimation()
Expand Down

0 comments on commit 58448d3

Please sign in to comment.