Beispiel #1
0
        public static INode GetFirstIntersectedNode(IMapData Map, INode From, INode To)
        {
            INode[] nodes = Map.GetNodesBetween(From, To);

            for (int i = 0; i < nodes.Length; ++i)
            {
                INode node = nodes[i];

                if (node.State == NodeStates.Walkable)
                {
                    continue;
                }

                if (Utilities.LineIntersectsBounds(From.Position, To.Position, node.Bound.Min, node.Bound.Max))
                {
                    return(node);
                }
            }

            return(null);
        }