Use bindable for HealthDisplay.

This commit is contained in:
Dean Herbert
2017-01-18 13:40:13 +08:00
parent 8c7bb4990c
commit cd149f04fc
2 changed files with 6 additions and 5 deletions

View File

@ -14,6 +14,8 @@ namespace osu.Game.Modes.UI
private Box background;
private Box fill;
public BindableDouble Current = new BindableDouble();
public HealthDisplay()
{
Children = new Drawable[]
@ -30,13 +32,12 @@ namespace osu.Game.Modes.UI
Scale = new Vector2(0, 1),
},
};
Current.ValueChanged += current_ValueChanged;
}
public double Current;
public void Set(double value)
private void current_ValueChanged(object sender, EventArgs e)
{
Current = value;
fill.ScaleTo(new Vector2((float)Current, 1), 200, EasingTypes.OutQuint);
}
}