示例#1
0
    static void AddToList(PathPoint nextPoint, PathPoint point, List <PathPoint> points)
    {
        // Remove if the point has been check already.
        if (nextPoint.state == PathPoint.State.Closed)
        {
            return;
        }

        // Remove if the block is in the middle of a rotation.
        if (nextPoint.rotating)
        {
            return;
        }

        // remove if it is the previous point
        if (nextPoint == point.prev)
        {
            return;
        }

        if (nextPoint.state == PathPoint.State.Open)
        {
            if (!nextPoint.isCloser(point))
            {
                return;
            }
        }
        else
        {
            nextPoint.state = PathPoint.State.Open;
        }

        nextPoint.setPrev(point);

        nextPoint.state = PathPoint.State.Open;

        points.Add(nextPoint);
    }