#nullable enable
namespace TagFighter.Effects.Steps
{
using System.Collections.Generic;
using System.Linq;
[StepType(StepTypeAttribute.ReleaseStep)]
public class ReleaseEffect : ReleaseStep
{
[UnityEngine.SerializeField]
SinglePort<bool> _in = new();
[UnityEngine.SerializeField]
SinglePort<IAreaOfEffect> _aoe = new() {
DisplayName = "Area"
};
static SingleTarget s_defaultAOE = new();
public override IEnumerable<IPort> Inputs {
get {
yield return _in;
yield return _aoe;
}
}
public override bool IsValid => true;
public override string ToString() => "Release Effect";
public override void Run(EffectInput blackBoard) {
var aoe = _aoe.Node != null ? _aoe.Node.Run(blackBoard) : s_defaultAOE;
blackBoard.Affected = aoe.GetAffectedUnits(blackBoard.Context.Caster, blackBoard.Context.EffectLocation).ToList();
if (_in.Node != null) {
_in.Node.Run(blackBoard);
}
}
}
}