示例#1
0
    public static bool IsClosing(Ship.GenericShip thisShip, Ship.GenericShip anotherShip)
    {
        bool  result          = false;
        float distanceToFront = Vector3.Distance(thisShip.GetPosition(), anotherShip.GetCentralFrontPoint());
        float distanceToBack  = Vector3.Distance(thisShip.GetPosition(), anotherShip.GetCentralBackPoint());

        result = (distanceToFront < distanceToBack) ? true : false;
        return(result);
    }
示例#2
0
    public static bool IsClosing(Ship.GenericShip thisShip, Ship.GenericShip anotherShip)
    {
        bool result = false;

        ShipDistanceInformation distanceInfo = new ShipDistanceInformation(thisShip, anotherShip);
        int range = distanceInfo.Range;

        if (range <= 1)
        {
            return(true);
        }
        if (range >= 3)
        {
            return(false);
        }

        float distanceToFront = Vector3.Distance(thisShip.GetPosition(), anotherShip.GetCentralFrontPoint());
        float distanceToBack  = Vector3.Distance(thisShip.GetPosition(), anotherShip.GetCentralBackPoint());

        result = (distanceToFront < distanceToBack) ? true : false;
        return(result);
    }