Ejemplo n.º 1
0
    private double GetMinDistanceToVessels(PlanetManager.Chunck chunck)
    {
        double num = double.PositiveInfinity;

        for (int i = 0; i < Ref.controller.vessels.Count; i++)
        {
            if (Ref.controller.vessels[i].state == Vessel.State.RealTime || Ref.controller.vessels[i].state == Vessel.State.Stationary)
            {
                Double3 @double            = (Ref.controller.vessels[i].state != Vessel.State.RealTime) ? Ref.controller.vessels[i].GetGlobalPosition : (Ref.positionOffset + Ref.controller.vessels[i].partsManager.rb2d.transform.position);
                double  closestPointOnLine = Double3.GetClosestPointOnLine(chunck.topPosition, @double);
                Double3 a    = chunck.topPosition * closestPointOnLine;
                double  num2 = (a - @double).magnitude2d - chunck.topSizeHalf * closestPointOnLine;
                if (num2 < num)
                {
                    num = num2;
                }
            }
        }
        return(num);
    }