XVector2.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. //using Newtonsoft.Json;
  2. using UnityEngine;
  3. namespace PublicTools.Unity
  4. {
  5. public struct XVector2
  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. // Constructs a new vector with given x, y components.
  18. //
  19. // 参数:
  20. // x:
  21. //
  22. // y:
  23. public XVector2(float x, float y)
  24. {
  25. this.x = x;
  26. this.y = y;
  27. }
  28. public XVector2(Vector2 vector2)
  29. {
  30. this.x = vector2.x;
  31. this.y = vector2.y;
  32. }
  33. public Vector2 Trans()
  34. {
  35. Vector2 vector = Vector2.zero;
  36. vector.x = this.x;
  37. vector.y = this.y;
  38. return vector;
  39. }
  40. public void Trans(Vector2 vector2)
  41. {
  42. this.x = vector2.x;
  43. this.y = vector2.y;
  44. }
  45. //public override string ToString()
  46. //{
  47. // return JsonConvert.SerializeObject(this);
  48. //}
  49. }
  50. }