Exemple #1
0
 public float Distance(Vector2 p)
 {
     if (Inside(p))
     {
         return(0);
     }
     if (ObjectManager.Player.Position.To2D().IsLeft(rekt[0], rekt[3]))
     {
         return(ObjectManager.Player.Position.To2D().IsLeft(rekt[1], rekt[2]) ? DUtility.LineToPointDistance2D(rekt[1], rekt[3], p) : DUtility.LineToPointDistance2D(rekt[0], rekt[1], p));
     }
     return(ObjectManager.Player.Position.To2D().IsLeft(rekt[1], rekt[2]) ? DUtility.LineToPointDistance2D(rekt[2], rekt[3], p) : DUtility.LineToPointDistance2D(rekt[0], rekt[2], p));
 }