Maze / Library /PackageCache /com.unity.visualscripting@1.8.0 /Runtime /VisualScripting.Flow /Framework /Logic /NotApproximatelyEqual.cs
| using System; | |
| using UnityEngine; | |
| namespace Unity.VisualScripting | |
| { | |
| /// <summary> | |
| /// Compares two numbers to determine if they are not approximately equal (disregarding floating point precision errors). | |
| /// </summary> | |
| [] | |
| [] | |
| [] | |
| [] | |
| [] | |
| public sealed class NotApproximatelyEqual : Unit | |
| { | |
| /// <summary> | |
| /// The first number. | |
| /// </summary> | |
| [] | |
| public ValueInput a { get; private set; } | |
| /// <summary> | |
| /// The second number. | |
| /// </summary> | |
| [] | |
| public ValueInput b { get; private set; } | |
| /// <summary> | |
| /// Whether A is not approximately equal to B. | |
| /// </summary> | |
| [] | |
| [] | |
| public ValueOutput notEqual { get; private set; } | |
| protected override void Definition() | |
| { | |
| a = ValueInput<float>(nameof(a)); | |
| b = ValueInput<float>(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<float>(a), flow.GetValue<float>(b)); | |
| } | |
| } | |
| } | |