public bool CheckCollision(Actor actor) { obj0 = actor.GetRectBox(); dx = MathUtils.Abs(obj0.GetCenterX() - x); dy = MathUtils.Abs(obj0.GetCenterY() - y); dist = MathUtils.Sqrt(dx * dx + dy * dy); return(dist <= this.r); }
/// <summary> /// 返回中间距离的Point2D形式 /// </summary> /// /// <param name="rectangle"></param> /// <returns></returns> private static Point GetMiddlePoint(RectBox rectangle) { return(new Point(rectangle.GetCenterX(), rectangle.GetCenterY())); }