public float DistanceTo(ShipStructure structure) { Vector2 closestShipPoint = structure.ClosestPoint(transform.position); Vector2 closestComponentPoint = collider2d.ClosestPoint(closestShipPoint); return(Vector2.Distance(closestShipPoint, closestComponentPoint)); }
public float DistanceTo(ShipStructure structure) { Vector2 closestOtherPoint = structure.ClosestPoint(transform.position); Vector2 closestPoint = ClosestPoint(closestOtherPoint); return(Vector2.Distance(closestOtherPoint, closestPoint)); }