using UnityEngine;
namespace Unity.VisualScripting
{
///
/// Compares two inputs.
///
[UnitCategory("Logic")]
[UnitTitle("Comparison")]
[UnitShortTitle("Comparison")]
[UnitOrder(99)]
public sealed class Comparison : Unit
{
///
/// The first input.
///
[DoNotSerialize]
public ValueInput a { get; private set; }
///
/// The second input.
///
[DoNotSerialize]
public ValueInput b { get; private set; }
///
/// Whether the compared inputs are numbers.
///
[Serialize]
[Inspectable]
public bool numeric { get; set; } = true;
///
/// Whether A is less than B.
///
[DoNotSerialize]
[PortLabel("A < B")]
public ValueOutput aLessThanB { get; private set; }
///
/// Whether A is less than or equal to B.
///
[DoNotSerialize]
[PortLabel("A \u2264 B")]
public ValueOutput aLessThanOrEqualToB { get; private set; }
///
/// Whether A is equal to B.
///
[DoNotSerialize]
[PortLabel("A = B")]
public ValueOutput aEqualToB { get; private set; }
///
/// Whether A is not equal to B.
///
[DoNotSerialize]
[PortLabel("A \u2260 B")]
public ValueOutput aNotEqualToB { get; private set; }
///
/// Whether A is greater than or equal to B.
///
[DoNotSerialize]
[PortLabel("A \u2265 B")]
public ValueOutput aGreaterThanOrEqualToB { get; private set; }
///
/// Whether A is greater than B.
///
[DoNotSerialize]
[PortLabel("A > B")]
public ValueOutput aGreatherThanB { get; private set; }
protected override void Definition()
{
if (numeric)
{
a = ValueInput(nameof(a));
b = ValueInput(nameof(b), 0);
aLessThanB = ValueOutput(nameof(aLessThanB), (flow) => NumericLess(flow.GetValue(a), flow.GetValue(b))).Predictable();
aLessThanOrEqualToB = ValueOutput(nameof(aLessThanOrEqualToB), (flow) => NumericLessOrEqual(flow.GetValue(a), flow.GetValue(b))).Predictable();
aEqualToB = ValueOutput(nameof(aEqualToB), (flow) => NumericEqual(flow.GetValue(a), flow.GetValue(b))).Predictable();
aNotEqualToB = ValueOutput(nameof(aNotEqualToB), (flow) => NumericNotEqual(flow.GetValue(a), flow.GetValue(b))).Predictable();
aGreaterThanOrEqualToB = ValueOutput(nameof(aGreaterThanOrEqualToB), (flow) => NumericGreaterOrEqual(flow.GetValue(a), flow.GetValue(b))).Predictable();
aGreatherThanB = ValueOutput(nameof(aGreatherThanB), (flow) => NumericGreater(flow.GetValue(a), flow.GetValue(b))).Predictable();
}
else
{
a = ValueInput