public static Vector3int Process(Vector3int v, Func <int, int> func) { v.x = func(v.x); v.y = func(v.y); v.z = func(v.z); return(v); }
public static Vector3int Process(Vector3int a, Vector3int b, Func <int, int, int> func) { a.x = func(a.x, b.x); a.y = func(a.y, b.y); a.z = func(a.z, b.z); return(a); }
//重写方法 public override bool Equals(object other) { if (other is Vector3int == false) { return(false); } Vector3int vector = (Vector3int)other; return(x == vector.x && y == vector.y && z == vector.z); }
public static Vector3int Abs(Vector3int a) { return(Process(a, Mathf.Abs)); }
public static Vector3int Max(Vector3int a, Vector3int b) { return(Process(a, b, Mathf.Max)); }
public static Vector3int Div(Vector3int a, Vector3int b) { return(new Vector3int(a.x / b.x, a.y / b.y, a.z / b.z)); }
//计算函数 public static Vector3int Mul(Vector3int a, Vector3int b) { return(new Vector3int(a.x * b.x, a.y * b.y, a.z * b.z)); }