XVector3.cs 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using Newtonsoft.Json;
  2. using UnityEngine;
  3. namespace PublicTools.Unity
  4. {
  5. public struct XVector3
  6. {
  7. //
  8. // 摘要:
  9. // X component of the vector.
  10. public float x;
  11. //
  12. // 摘要:
  13. // Y component of the vector.
  14. public float y;
  15. //
  16. // 摘要:
  17. // Z component of the vector.
  18. public float z;
  19. public XVector3(float x, float y, float z)
  20. {
  21. this.x = x;
  22. this.y = y;
  23. this.z = z;
  24. }
  25. public XVector3(Vector3 vector3)
  26. {
  27. this.x = vector3.x;
  28. this.y = vector3.y;
  29. this.z = vector3.z;
  30. }
  31. public Vector3 Trans()
  32. {
  33. Vector3 vector = Vector3.zero;
  34. vector.x = this.x;
  35. vector.y = this.y;
  36. vector.z = this.z;
  37. return vector;
  38. }
  39. public override string ToString()
  40. {
  41. return JsonConvert.SerializeObject(this);
  42. }
  43. }
  44. }