Exemplo n.º 1
0
        private double DistanceFunc(Algorithms.Point a, Algorithms.Point b)
        {
            double dx = a.X - b.X;
            double dy = a.Y - b.Y;

            return(dx * dx + dy * dy);
        }
Exemplo n.º 2
0
        public List <Algorithms.PathFinderNode> FindPath(Point from, Point endPoint, bool forHeroAlly, bool canGoOverCrackedStone,
                                                         bool forEnemyProjectile)
        {
            //Commons.TimeTracker tr = new Commons.TimeTracker();

            var startPoint     = new Algorithms.Point(from.Y, from.X);
            var findPathMatrix = InitMatrixBeforePathSearch(from, endPoint, forHeroAlly, canGoOverCrackedStone, forEnemyProjectile);

            var mPathFinder = new Algorithms.PathFinder(findPathMatrix);

            mPathFinder.Diagonals = false;

            var path = mPathFinder.FindPath(startPoint, new Algorithms.Point(endPoint.Y, endPoint.X));

            if (path != null)
            {
                //System.Diagnostics.//Debug.WriteLine("FindPathTest len = " + path.Count);
            }
            //if (worstPathFind < tr.TotalMiliseconds)
            //    worstPathFind = tr.TotalMiliseconds;
            //Log.AddInfo("FindPathTest end time : " + tr.TotalMiliseconds + ", worstPathFind = " + worstPathFind);
            return(path);
        }
Exemplo n.º 3
0
 private Algorithms.Point MergeFunc(Algorithms.Point a, Algorithms.Point b)
 {
     return((a + b) / 2);
 }