#nullable enable


namespace TagFighter.Effects.Steps
{
    using System.Collections.Generic;
    using System.Linq;

    [StepType(StepTypeAttribute.OperatorStep)]
    public class Repeat : OutputStep<IEnumerable<double>>
    {
        [UnityEngine.SerializeField]
        SinglePort<double> _in = new();

        public override IEnumerable<double> Run(EffectInput blackBoard) {
            var value = _in.Node != null ? _in.Node.Run(blackBoard) : default;
            return blackBoard.Affected.Select(transform => value);
        }

        public override IEnumerable<IPort> Inputs {
            get {
                yield return _in;
            }
        }

        public override string ToString() => "Repeat";

        public override bool IsValid => true;
    }

}