Mark the property as nullable and add some assert check.

This commit is contained in:
為什麼
2022-07-10 23:47:57 +08:00
committed by andy840119
parent deb39bd330
commit 9134525111
7 changed files with 45 additions and 15 deletions

View File

@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Diagnostics;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
@ -31,7 +32,7 @@ namespace osu.Game.Rulesets.Osu.Mods
public override double ScoreMultiplier => UsesDefaultConfiguration ? 1.12 : 1;
public override Type[] IncompatibleMods => new[] { typeof(OsuModFlashlight) };
private DrawableOsuBlinds blinds;
private DrawableOsuBlinds? blinds;
public void ApplyToDrawableRuleset(DrawableRuleset<OsuHitObject> drawableRuleset)
{
@ -40,6 +41,8 @@ namespace osu.Game.Rulesets.Osu.Mods
public void ApplyToHealthProcessor(HealthProcessor healthProcessor)
{
Debug.Assert(blinds != null);
healthProcessor.Health.ValueChanged += health => { blinds.AnimateClosedness((float)health.NewValue); };
}