Ejemplo n.º 1
0
 /// <summary>
 /// Check whether a bullet shot now would hit any parts of the TargetAircraft (if the TargetAircraft wouldn't move).
 /// </summary>
 /// <param name="partsInRange"></param>
 /// <returns>whether the bullet would hit</returns>
 internal bool WouldHit()
 {
     Constants.CCDegreesToDxDy(MyPart.TotalRotation, out float dx, out float dy);
     CollisionTypeLine cTypeReachLine = new CollisionTypeLine(MyPart.PositionWorldspace, MyPart.PositionWorldspace + new CCPoint(dx * Reach, dy * Reach));
     foreach (Part part in TargetAircraft.TotalParts)
     {
         if (Collisions.CollidePolygonLine(part, ((CollisionTypePolygon)part.CollisionType), cTypeReachLine))
             return true;
     }
     return false;
 }