mirror of
https://github.com/ppy/osu.git
synced 2025-02-24 19:02:59 +08:00
Store FailTrigger in HealthProcessor
This commit is contained in:
parent
307a0e8bfa
commit
2aeda54865
@ -5,6 +5,7 @@ using System;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Utils;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
|
||||
namespace osu.Game.Rulesets.Scoring
|
||||
{
|
||||
@ -31,16 +32,24 @@ namespace osu.Game.Rulesets.Scoring
|
||||
/// </summary>
|
||||
public bool HasFailed { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Object that triggered fail
|
||||
/// </summary>
|
||||
public object? FailTrigger;
|
||||
|
||||
/// <summary>
|
||||
/// Immediately triggers a failure for this HealthProcessor.
|
||||
/// </summary>
|
||||
public void TriggerFailure()
|
||||
public void TriggerFailure(object? Trigger = null)
|
||||
{
|
||||
if (HasFailed)
|
||||
return;
|
||||
|
||||
if (Failed?.Invoke() != false)
|
||||
HasFailed = true;
|
||||
|
||||
if (Trigger != null)
|
||||
FailTrigger = Trigger;
|
||||
}
|
||||
|
||||
protected override void ApplyResultInternal(JudgementResult result)
|
||||
@ -92,9 +101,12 @@ namespace osu.Game.Rulesets.Scoring
|
||||
{
|
||||
bool conditionResult = (bool)condition.Method.Invoke(condition.Target, new object[] { this, result })!;
|
||||
if (conditionResult)
|
||||
{
|
||||
FailTrigger = condition.Target;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user