예제 #1
0
 public override bool Collision(Collider c)
 {
     if (working)
     {
         if (c is RoundCollider)
         {
             RoundCollider rd           = (RoundCollider)c;
             double        missDistance = 15;
             if (Datas.CurrentPlayer.CurrentCharactor.Name == "")
             {
                 missDistance = 25;
             }
             double r = rd.GetRadius();
             double x = rd.GetX();
             double y = rd.GetY();
             lenth = ((x - Position.X) * (x - Position.X) + (y - Position.Y) * (y - Position.Y));
             if (lenth < (missDistance + radius) * (missDistance + radius))
             {
                 //擦弹
                 missed         = true;
                 missedPosition = new Vector2D(x - Position.X, y - Position.Y).GetNormalize();
                 if (lenth < (r + radius) * (r + radius))
                 {
                     return(true);
                 }
             }
         }
     }
     return(false);
 }
예제 #2
0
 public bool Collision(Collider c)
 {
     if (c is RoundCollider)
     {
         RoundCollider e = (RoundCollider)c;
         double        x1 = e.GetX(), y1 = e.GetY(), r1 = e.GetRadius();
         if (((Position.X - x1) * (Position.X - x1) + (Position.Y - y1) * (Position.Y - y1))
             < ((radius + r1) * (radius + r1)))
         {
             return(true);
         }
         return(false);
     }
     return(false);
 }
예제 #3
0
        public override bool Collision(Collider c)
        {
            if (c is RoundCollider)
            {
                RoundCollider cc = (RoundCollider)c;
                double        r  = cc.GetRadius();
                double        x  = cc.GetX();
                double        y  = cc.GetY();
                for (int i = 8; i < dividecount - 8; i++)
                {
                    if (((x - positions[i].X) * (x - positions[i].X) + (y - positions[i].Y) * (y - positions[i].Y))
                        < (r + radius) * (r + radius))
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
예제 #4
0
 public virtual bool Collision(Collider c)
 {
     if (working)
     {
         if (c is RoundCollider)
         {
             RoundCollider rd = (RoundCollider)c;
             double        r  = rd.GetRadius();
             double        x  = rd.GetX();
             double        y  = rd.GetY();
             if (((x - Position.X) * (x - Position.X) + (y - Position.Y) * (y - Position.Y))
                 < (r + radius) * (r + radius))
             {
                 working = false;            //停止工作
                 Hit();
                 return(true);
             }
         }
     }
     return(false);
 }
예제 #5
0
 public override bool Collision(Collider c)
 {
     if (working)
     {
         if (c is RoundCollider)
         {
             RoundCollider rd = (RoundCollider)c;
             double        r  = rd.GetRadius();
             double        x  = rd.GetX();
             double        y  = rd.GetY();
             if (((x - Position.X) * (x - Position.X) + (y - Position.Y) * (y - Position.Y))
                 < (r + radius) * (r + radius))
             {
                 working   = false;          //停止工作
                 disposing = true;           //进入正在注销状态
                 return(true);
             }
         }
     }
     return(false);
 }