VFXVector2Field.cs 1012 B

12345678910111213141516171819202122232425262728293031323334353637
  1. using UnityEngine;
  2. using UnityEngine.UIElements;
  3. using UnityEditor.UIElements;
  4. using System.Collections.Generic;
  5. using FloatField = UnityEditor.VFX.UI.VFXLabeledField<UnityEditor.UIElements.FloatField, float>;
  6. namespace UnityEditor.VFX.UI
  7. {
  8. class VFXVector2Field : VFXVectorNField<Vector2>
  9. {
  10. protected override int componentCount { get { return 2; } }
  11. protected override void SetValueComponent(ref Vector2 value, int i, float componentValue)
  12. {
  13. switch (i)
  14. {
  15. case 0:
  16. value.x = componentValue;
  17. break;
  18. default:
  19. value.y = componentValue;
  20. break;
  21. }
  22. }
  23. protected override float GetValueComponent(ref Vector2 value, int i)
  24. {
  25. switch (i)
  26. {
  27. case 0:
  28. return value.x;
  29. default:
  30. return value.y;
  31. }
  32. }
  33. }
  34. }