using System;
using UnityEngine;
namespace Unity.VisualScripting
{
///
/// Compares two numbers to determine if they are not approximately equal (disregarding floating point precision errors).
///
[UnitCategory("Logic")]
[UnitShortTitle("Not Equal")]
[UnitSubtitle("(Approximately)")]
[UnitOrder(8)]
[Obsolete("Use the Not Equal node with Numeric enabled instead.")]
public sealed class NotApproximatelyEqual : Unit
{
///
/// The first number.
///
[DoNotSerialize]
public ValueInput a { get; private set; }
///
/// The second number.
///
[DoNotSerialize]
public ValueInput b { get; private set; }
///
/// Whether A is not approximately equal to B.
///
[DoNotSerialize]
[PortLabel("A \u2249 B")]
public ValueOutput notEqual { get; private set; }
protected override void Definition()
{
a = ValueInput(nameof(a));
b = ValueInput(nameof(b), 0);
notEqual = ValueOutput(nameof(notEqual), Comparison).Predictable();
Requirement(a, notEqual);
Requirement(b, notEqual);
}
public bool Comparison(Flow flow)
{
return !Mathf.Approximately(flow.GetValue(a), flow.GetValue(b));
}
}
}