示例#1
0
        //Find path using A-Star Pathfinder
        private void findPath()
        {
            //GO!
            var       finder = new ClopPathFinder(_clpWar.Field);
            IClopNode bestn  = finder.FindPath(_ebx, _eby, _bx, _by);

            //Write found path into bestpath
            _bestpath = new ArrayList();
            IClopNode n = bestn;

            while (n != null)
            {
                n.inpath = true;
                _bestpath.Add(n);
                n = n.Parent;
            }
        }
示例#2
0
        private double findPathLength()
        {
            //GO!
            var       finder = new ClopPathFinder(_clpWar.Field);
            IClopNode bestn  = finder.FindPath(_ebx, _eby, _bx, _by);

            //Count path length
            //int len = 0;
            IClopNode n = bestn;

            /*while (n!=null)
             *          {
             *                  n=n.Parent;
             *                  len++;
             *          }*/

            return(n.gdist);
        }