示例#1
0
        public override bool Intersects(BaseObject o)
        {
            float   angle = (float)Math.Atan2(o.CenterPoint.Y - centerPoint.Y, o.CenterPoint.X - centerPoint.X);
            Vector2 point = centerPoint + new Vector2(radius * (float)Math.Cos(angle), radius * (float)Math.Sin(angle));

            return(o.Touches(point));
        }
示例#2
0
文件: Unit.cs 项目: nubington/bill
        public override bool Intersects(BaseObject o)
        {
            float   angle = (float)Math.Atan2(o.CenterPoint.Y - centerPoint.Y, o.CenterPoint.X - centerPoint.X);
            Vector2 point = centerPoint + new Vector2(Radius * (float)Math.Cos(angle), Radius * (float)Math.Sin(angle));

            //return o.Touches(point);

            return(o.Touches(point));// ||
            //((Math.Abs(centerPoint.X - o.X) < radius || Math.Abs(centerPoint.X - (o.X  + o.Width)) < radius) &&
            //(Math.Abs(centerPoint.Y - o.Y) < radius || Math.Abs(centerPoint.Y - (o.Y + o.Height)) < radius));
        }
示例#3
0
 public override bool Intersects(BaseObject o)
 {
     float angle = (float)Math.Atan2(o.CenterPoint.Y - centerPoint.Y, o.CenterPoint.X - centerPoint.X);
     Vector2 point = centerPoint + new Vector2(radius * (float)Math.Cos(angle), radius * (float)Math.Sin(angle));
     return o.Touches(point);
 }
示例#4
0
文件: Unit.cs 项目: nubington/bill
        public override bool Intersects(BaseObject o)
        {
            float angle = (float)Math.Atan2(o.CenterPoint.Y - centerPoint.Y, o.CenterPoint.X - centerPoint.X);
            Vector2 point = centerPoint + new Vector2(Radius * (float)Math.Cos(angle), Radius * (float)Math.Sin(angle));
            //return o.Touches(point);

            return o.Touches(point);// ||
                //((Math.Abs(centerPoint.X - o.X) < radius || Math.Abs(centerPoint.X - (o.X  + o.Width)) < radius) &&
                //(Math.Abs(centerPoint.Y - o.Y) < radius || Math.Abs(centerPoint.Y - (o.Y + o.Height)) < radius));
        }