IsValidLine() private static method

private static IsValidLine ( Point position, int xOffset, int yOffset ) : bool
position Point
xOffset int
yOffset int
return bool
Beispiel #1
0
        private static bool FindValidLine(Point position, int xOffset, int yOffset, out Point bestPosition)
        {
            bestPosition = position;
            if (PortalHelper.IsValidLine(position, xOffset, yOffset))
            {
                return(true);
            }
            Point position1;

            // ISSUE: explicit reference operation
            ((Point)@position1).\u002Ector(position.X - xOffset, position.Y - yOffset);
            if (PortalHelper.IsValidLine(position1, xOffset, yOffset))
            {
                bestPosition = position1;
                return(true);
            }
            Point position2;

            // ISSUE: explicit reference operation
            ((Point)@position2).\u002Ector(position.X + xOffset, position.Y + yOffset);
            if (!PortalHelper.IsValidLine(position2, xOffset, yOffset))
            {
                return(false);
            }
            bestPosition = position2;
            return(true);
        }
Beispiel #2
0
        private static bool FindValidLine(
            Point position,
            int xOffset,
            int yOffset,
            out Point bestPosition)
        {
            bestPosition = position;
            if (PortalHelper.IsValidLine(position, xOffset, yOffset))
            {
                return(true);
            }
            Point position1 = new Point(position.X - xOffset, position.Y - yOffset);

            if (PortalHelper.IsValidLine(position1, xOffset, yOffset))
            {
                bestPosition = position1;
                return(true);
            }
            Point position2 = new Point(position.X + xOffset, position.Y + yOffset);

            if (!PortalHelper.IsValidLine(position2, xOffset, yOffset))
            {
                return(false);
            }
            bestPosition = position2;
            return(true);
        }