Vector4Comparer.cs 764 B

12345678910111213141516171819202122232425262728293031323334353637
  1. using System;
  2. using UnityEngine;
  3. namespace UnityTest
  4. {
  5. public class Vector4Comparer : VectorComparerBase<Vector4>
  6. {
  7. public enum CompareType
  8. {
  9. MagnitudeEquals,
  10. MagnitudeNotEquals
  11. }
  12. public CompareType compareType;
  13. public double floatingPointError;
  14. protected override bool Compare (Vector4 a, Vector4 b)
  15. {
  16. switch (compareType)
  17. {
  18. case CompareType.MagnitudeEquals:
  19. return AreVectorMagnitudeEqual (a.magnitude,
  20. b.magnitude,
  21. floatingPointError);
  22. case CompareType.MagnitudeNotEquals:
  23. return !AreVectorMagnitudeEqual (a.magnitude,
  24. b.magnitude,
  25. floatingPointError);
  26. }
  27. throw new Exception();
  28. }
  29. public override int GetDepthOfSearch()
  30. {
  31. return 3;
  32. }
  33. }
  34. }