Initialize some bindables for prevent get the null instance.

This commit is contained in:
為什麼
2022-07-10 23:16:51 +08:00
committed by andy840119
parent 1f9f2b413e
commit ce1bb206c8
4 changed files with 10 additions and 10 deletions

View File

@ -28,9 +28,9 @@ namespace osu.Game.Rulesets.Mods
protected const float TRANSITION_DURATION = 100;
protected BindableNumber<int> CurrentCombo;
protected readonly BindableNumber<int> CurrentCombo = new BindableInt();
protected IBindable<bool> IsBreakTime;
protected readonly IBindable<bool> IsBreakTime = new Bindable<bool>();
protected float ComboBasedAlpha;
@ -40,14 +40,14 @@ namespace osu.Game.Rulesets.Mods
public void ApplyToPlayer(Player player)
{
IsBreakTime = player.IsBreakTime.GetBoundCopy();
IsBreakTime.BindTo(player.IsBreakTime);
}
public void ApplyToScoreProcessor(ScoreProcessor scoreProcessor)
{
if (HiddenComboCount.Value == 0) return;
CurrentCombo = scoreProcessor.Combo.GetBoundCopy();
CurrentCombo.BindTo(scoreProcessor.Combo);
CurrentCombo.BindValueChanged(combo =>
{
ComboBasedAlpha = Math.Max(MIN_ALPHA, 1 - (float)combo.NewValue / HiddenComboCount.Value);