📅  最后修改于: 2022-03-11 14:49:24.150000             🧑  作者: Mango
//For 2D Unity C#
float GetDistance(Vector2 posA, Vector2 posB) {
float dx = posA.x - posB.x;
float dy = posA.y - posB.y;
float distance = Mathf.Sqrt(dx * dx + dy * dy);
return distance;
}