using Newtonsoft.Json; using UnityEngine; namespace PublicTools.Unity { public struct XVector2 { // // 摘要: // X component of the vector. public float x; // // 摘要: // Y component of the vector. public float y; // // 摘要: // Constructs a new vector with given x, y components. // // 参数: // x: // // y: public XVector2(float x, float y) { this.x = x; this.y = y; } public XVector2(Vector2 vector2) { this.x = vector2.x; this.y = vector2.y; } public Vector2 Trans() { Vector2 vector = Vector2.zero; vector.x = this.x; vector.y = this.y; return vector; } public void Trans(Vector2 vector2) { this.x = vector2.x; this.y = vector2.y; } public override string ToString() { return JsonConvert.SerializeObject(this); } } }