Keine Beschreibung
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

Equal.cs 947B

1234567891011121314151617181920212223242526272829303132333435363738
  1. using UnityEngine;
  2. namespace Unity.VisualScripting
  3. {
  4. /// <summary>
  5. /// Compares two inputs to determine whether they are equal.
  6. /// </summary>
  7. [UnitCategory("Logic")]
  8. [UnitOrder(5)]
  9. public sealed class Equal : BinaryComparisonUnit
  10. {
  11. public Equal() : base()
  12. {
  13. numeric = false;
  14. }
  15. // Backward compatibility
  16. protected override string outputKey => "equal";
  17. /// <summary>
  18. /// Whether A is equal to B.
  19. /// </summary>
  20. [DoNotSerialize]
  21. [PortLabel("A = B")]
  22. [PortKey("equal")]
  23. public override ValueOutput comparison => base.comparison;
  24. protected override bool NumericComparison(float a, float b)
  25. {
  26. return Mathf.Approximately(a, b);
  27. }
  28. protected override bool GenericComparison(object a, object b)
  29. {
  30. return OperatorUtility.Equal(a, b);
  31. }
  32. }
  33. }