mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 14:02:55 +08:00
Clean up member order & access modifiers
This commit is contained in:
parent
02f590309d
commit
3637bf2f9b
@ -18,10 +18,15 @@ using osuTK.Graphics;
|
|||||||
namespace osu.Game.Screens.Play.HUD
|
namespace osu.Game.Screens.Play.HUD
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// An overlay layer on top of the playfield which fades to red when the current player health falls below a certain threshold defined by <see cref="LowHealthThreshold"/>.
|
/// An overlay layer on top of the playfield which fades to red when the current player health falls below a certain threshold defined by <see cref="low_health_threshold"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class FailingLayer : HealthDisplay
|
public class FailingLayer : HealthDisplay
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Whether the current player health should be shown on screen.
|
||||||
|
/// </summary>
|
||||||
|
public readonly Bindable<bool> ShowHealth = new Bindable<bool>();
|
||||||
|
|
||||||
private const float max_alpha = 0.4f;
|
private const float max_alpha = 0.4f;
|
||||||
private const int fade_time = 400;
|
private const int fade_time = 400;
|
||||||
private const float gradient_size = 0.3f;
|
private const float gradient_size = 0.3f;
|
||||||
@ -29,12 +34,7 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The threshold under which the current player life should be considered low and the layer should start fading in.
|
/// The threshold under which the current player life should be considered low and the layer should start fading in.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public double LowHealthThreshold = 0.20f;
|
private const double low_health_threshold = 0.20f;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Whether the current player health should be shown on screen.
|
|
||||||
/// </summary>
|
|
||||||
public readonly Bindable<bool> ShowHealth = new Bindable<bool>();
|
|
||||||
|
|
||||||
private readonly Bindable<bool> fadePlayfieldWhenHealthLow = new Bindable<bool>();
|
private readonly Bindable<bool> fadePlayfieldWhenHealthLow = new Bindable<bool>();
|
||||||
private readonly Container boxes;
|
private readonly Container boxes;
|
||||||
@ -119,7 +119,7 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
{
|
{
|
||||||
double target = Math.Clamp(max_alpha * (1 - Current.Value / LowHealthThreshold), 0, max_alpha);
|
double target = Math.Clamp(max_alpha * (1 - Current.Value / low_health_threshold), 0, max_alpha);
|
||||||
|
|
||||||
boxes.Alpha = (float)Interpolation.Lerp(boxes.Alpha, target, Clock.ElapsedFrameTime * 0.01f);
|
boxes.Alpha = (float)Interpolation.Lerp(boxes.Alpha, target, Clock.ElapsedFrameTime * 0.01f);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user