Ejemplo n.º 1
0
        public List <DrivingNode> Go(Point startPoint, Point endPoint, Reusables reusables)
        {
            reusables.Clear();
            this.startPoint = startPoint;
            this.endPoint   = endPoint;
            foundTarget     = false;
            Point     workingPoint;
            AStarNode workingNode;

            reusables.toCheckList.Add(GetOneD(startPoint), new AStarNode(GetOneD(startPoint), GetOneD(startPoint), 0, 0, 255, true));

            for (int i = 0; i < maximumToCheck; i++)
            {
                if (NextRoundChecks(reusables, out workingPoint, out workingNode))
                {
                    AddNewPoints(reusables, workingPoint, workingNode);
                }
                else
                {
                    break;
                }
            }

            if (foundTarget)
            {
                //Debugging(checkedNodeList, toCheckList);
                return(GetDrivingNodeList(reusables, startPoint));
            }
            else
            {
                return(new List <DrivingNode>());
            }
        }
Ejemplo n.º 2
0
        public List <DrivingNode> Go(Point startPoint, Point endPointZ, bool reversed, out SearchResult searchResult, out Point midPoint, Vehicle currentVehicle, bool keepDestination, Reusables reusables)
        {
            reusables.Clear();
            //We were not using this before.  Does it affect anything.  Will it block vehilces in?
            this.currentVehicle = currentVehicle;
            this.startPoint     = startPoint;
            endPoint            = endPointZ;
            foundTarget         = false;
            foundRoad           = false;
            Point     workingPoint;
            AStarNode workingNode;

            reusables.toCheckList.Add(GetOneD(startPoint), new AStarNode(GetOneD(startPoint), GetOneD(startPoint), 0, 0, 0, false));

            for (int i = 0; i < maximumToCheck; i++)
            {
                if (NextRoundChecks(reusables, out workingPoint, out workingNode))
                {
                    AddNewPoints(reusables, workingPoint, workingNode);
                }
                else
                {
                    break;
                }
            }

            //         Debugging(checkedNodeList, toCheckList);
            if (foundTarget)
            {
                searchResult = SearchResult.EndFound;
                midPoint     = GetMidPoint(reversed);
                //Debugging(checkedNodeList, toCheckList);
                return(GetDrivingNodeList(reusables, reversed, startPoint, endPoint, keepDestination));
            }
            else if (foundRoad)
            {
                searchResult = SearchResult.RoadFound;
                midPoint     = GetMidPoint(reversed);
                //Debugging(checkedNodeList, toCheckList);
                return(GetDrivingNodeList(reusables, reversed, startPoint, endPoint, keepDestination));
            }
            else
            {
                searchResult = SearchResult.None;
                midPoint     = GetMidPoint(reversed);
                //Debugging(checkedNodeList, toCheckList);
                return(new List <DrivingNode>());
            }
        }