namespace Unity.VisualScripting
{
///
/// Returns true if either input is true.
///
[UnitCategory("Logic")]
[UnitOrder(1)]
public sealed class Or : Unit
{
///
/// The first boolean.
///
[DoNotSerialize]
public ValueInput a { get; private set; }
///
/// The second boolean.
///
[DoNotSerialize]
public ValueInput b { get; private set; }
///
/// True if either A or B is true; false otherwise.
///
[DoNotSerialize]
[PortLabel("A | B")]
public ValueOutput result { get; private set; }
protected override void Definition()
{
a = ValueInput(nameof(a));
b = ValueInput(nameof(b));
result = ValueOutput(nameof(result), Operation).Predictable();
Requirement(a, result);
Requirement(b, result);
}
public bool Operation(Flow flow)
{
return flow.GetValue(a) || flow.GetValue(b);
}
}
}