From 6e64a8f55ef5838a5d58625668138fb3c85e34db Mon Sep 17 00:00:00 2001 From: Gabe Livengood <47010459+ggliv@users.noreply.github.com> Date: Fri, 10 Jun 2022 13:13:35 -0400 Subject: [PATCH] use event to trigger failure --- osu.Game/Rulesets/Mods/ModFailCondition.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Rulesets/Mods/ModFailCondition.cs b/osu.Game/Rulesets/Mods/ModFailCondition.cs index 9500734408..63cebc9747 100644 --- a/osu.Game/Rulesets/Mods/ModFailCondition.cs +++ b/osu.Game/Rulesets/Mods/ModFailCondition.cs @@ -19,18 +19,18 @@ namespace osu.Game.Rulesets.Mods public virtual bool PerformFail() => true; public virtual bool RestartOnFail => Restart.Value; - private HealthProcessor healthProcessorInternal; + private event Action failureTriggered; public void ApplyToHealthProcessor(HealthProcessor healthProcessor) { - healthProcessorInternal = healthProcessor; + failureTriggered = healthProcessor.TriggerFailure; healthProcessor.FailConditions += FailCondition; } /// /// Immediately triggers a failure on the loaded . /// - protected void TriggerFailure() => healthProcessorInternal.TriggerFailure(); + protected void TriggerFailure() => failureTriggered?.Invoke(); /// /// Determines whether should trigger a failure. Called every time a