VFXVector4Field.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using UnityEngine;
  2. using UnityEngine.UIElements;
  3. using UnityEditor.UIElements;
  4. namespace UnityEditor.VFX.UI
  5. {
  6. class VFXVector4Field : VFXVectorNField<Vector4>
  7. {
  8. protected override int componentCount { get { return 4; } }
  9. protected override void SetValueComponent(ref Vector4 value, int i, float componentValue)
  10. {
  11. switch (i)
  12. {
  13. case 0:
  14. value.x = componentValue;
  15. break;
  16. case 1:
  17. value.y = componentValue;
  18. break;
  19. case 2:
  20. value.z = componentValue;
  21. break;
  22. default:
  23. value.w = componentValue;
  24. break;
  25. }
  26. }
  27. protected override float GetValueComponent(ref Vector4 value, int i)
  28. {
  29. switch (i)
  30. {
  31. case 0:
  32. return value.x;
  33. case 1:
  34. return value.y;
  35. case 2:
  36. return value.z;
  37. default:
  38. return value.w;
  39. }
  40. }
  41. }
  42. }