mirror of
https://github.com/ppy/osu.git
synced 2025-02-24 21:42:54 +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.Bindables;
|
||||||
using osu.Framework.Utils;
|
using osu.Framework.Utils;
|
||||||
using osu.Game.Rulesets.Judgements;
|
using osu.Game.Rulesets.Judgements;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Scoring
|
namespace osu.Game.Rulesets.Scoring
|
||||||
{
|
{
|
||||||
@ -31,16 +32,24 @@ namespace osu.Game.Rulesets.Scoring
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool HasFailed { get; private set; }
|
public bool HasFailed { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Object that triggered fail
|
||||||
|
/// </summary>
|
||||||
|
public object? FailTrigger;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Immediately triggers a failure for this HealthProcessor.
|
/// Immediately triggers a failure for this HealthProcessor.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void TriggerFailure()
|
public void TriggerFailure(object? Trigger = null)
|
||||||
{
|
{
|
||||||
if (HasFailed)
|
if (HasFailed)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (Failed?.Invoke() != false)
|
if (Failed?.Invoke() != false)
|
||||||
HasFailed = true;
|
HasFailed = true;
|
||||||
|
|
||||||
|
if (Trigger != null)
|
||||||
|
FailTrigger = Trigger;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void ApplyResultInternal(JudgementResult result)
|
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 })!;
|
bool conditionResult = (bool)condition.Method.Invoke(condition.Target, new object[] { this, result })!;
|
||||||
if (conditionResult)
|
if (conditionResult)
|
||||||
|
{
|
||||||
|
FailTrigger = condition.Target;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user