32 lines
855 B
C#
32 lines
855 B
C#
using UnityEngine;
|
|
|
|
public class TemporaryOutgoingModifierInterceptor : BrokerInterceptor
|
|
{
|
|
DamageOutputModifierEffectInstance outgoingModifier;
|
|
|
|
float finalValue;
|
|
|
|
protected override void Awake()
|
|
{
|
|
base.Awake();
|
|
|
|
outgoingModifier = GetComponentInParent<DamageOutputModifierEffectInstance>();
|
|
|
|
broker.OnOutgoingDamage.Subscribe(HandleDamageOutgoingModifierEffects, GameConstants.BrokerEventPriority.TemporaryAmplificationMods);
|
|
}
|
|
|
|
private void HandleDamageOutgoingModifierEffects(DamageArgs args)
|
|
{
|
|
finalValue = args.currentValue;
|
|
|
|
if (outgoingModifier.IsActive)
|
|
{
|
|
//Debug.Log("Incoming damage b4 mitigation: " + incomingValue);
|
|
|
|
finalValue = outgoingModifier.ModifyDamageOutput(finalValue);
|
|
|
|
args.currentValue = finalValue;
|
|
}
|
|
}
|
|
}
|