Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
 /// <summary>
 /// 返回中间距离的Point2D形式
 /// </summary>
 ///
 /// <param name="rectangle"></param>
 /// <returns></returns>
 private static Point GetMiddlePoint(RectBox rectangle)
 {
     return(new Point(rectangle.GetCenterX(), rectangle.GetCenterY()));
 }