Esempio n. 1
0
        internal override bool Hit(PickupBox pkbox, Entity entity)
        {
            Polyline polyline = entity as Polyline;

            if (polyline == null)
            {
                return(false);
            }

            Bounding pkBounding = pkbox.reservedBounding;

            for (int i = 1; i < polyline.NumberOfVertices; ++i)
            {
                LitMath.Line2 line = new LitMath.Line2(
                    polyline.GetPointAt(i - 1),
                    polyline.GetPointAt(i));

                if (LineHitter.BoundingIntersectWithLine(pkBounding, line))
                {
                    return(true);
                }
            }

            return(false);
        }
Esempio n. 2
0
        internal override bool Hit(PickupBox pkbox, Entity entity)
        {
            Line line = entity as Line;

            if (line == null)
            {
                return(false);
            }

            Bounding pkBounding = pkbox.reservedBounding;

            return(LineHitter.BoundingIntersectWithLine(
                       pkBounding,
                       new LitMath.Line2(line.startPoint, line.endPoint)));
        }