#nullable enable
namespace TagFighter.Effects.Steps
{
using System.Collections.Generic;
using System.Linq;
[StepType(StepTypeAttribute.GetterStep)]
public class ConstValue : OutputStep<double>
{
[UnityEngine.SerializeField]
double _value;
public override double Run(EffectInput blackBoard) {
return _value;
}
public override IEnumerable<IPort> Inputs => Enumerable.Empty<IPort>();
public override string ToString() {
return $"Const {_value}";
}
public override EffectStepNodeData ToData() {
var effectStepNodeData = base.ToData();
effectStepNodeData.Const = new() { _value };
return effectStepNodeData;
}
public override bool FromData(EffectStepNodeData effectStepNodeData, Dictionary<string, EffectStepNode> guidToNode) {
base.FromData(effectStepNodeData, guidToNode);
_value = effectStepNodeData.Const != null ? effectStepNodeData.Const.FirstOrDefault() : default;
return true;
}
public override bool IsValid => true;
}
}