Example #1
0
 private List<Vector2f> Calc(Field2D field_0, Vector2f start,
         Vector2f goal_1, bool flag_2)
 {
     if (start.Equals(goal_1))
     {
         List<Vector2f> v = new List<Vector2f>();
         CollectionUtils.Add(v, start);
         return v;
     }
     this.goal = goal_1;
     if (visitedCache == null)
     {
         visitedCache = new HashedSet();
     }
     else
     {
         CollectionUtils.Clear(visitedCache);
     }
     if (pathes == null)
     {
         pathes = new List<ScoredPath>();
     }
     else
     {
         CollectionUtils.Clear(pathes);
     }
     CollectionUtils.Add(visitedCache, start);
     if (path == null)
     {
         path = new List<Vector2f>();
     }
     else
     {
         CollectionUtils.Clear(path);
     }
     CollectionUtils.Add(path, start);
     if (spath == null)
     {
         spath = new AStarFinder.ScoredPath(0, path);
     }
     else
     {
         spath.score = 0;
         spath.path = path;
     }
     CollectionUtils.Add(pathes, spath);
     return Astar(field_0, flag_2);
 }
Example #2
0
 public virtual void Dispose()
 {
     if (path == null)
     {
         CollectionUtils.Clear(path);
         path = null;
     }
     if (pathes != null)
     {
         CollectionUtils.Clear(pathes);
         pathes = null;
     }
     if (visitedCache != null)
     {
         CollectionUtils.Clear(visitedCache);
         visitedCache = null;
     }
     spath = null;
     goal = null;
 }
Example #3
0
 private List<Vector2f> Calc(Field2D field, Vector2f start,
         Vector2f goal, bool flag)
 {
     if (start.Equals(goal))
     {
         List<Vector2f> v = new List<Vector2f>();
         v.Add(start);
         return v;
     }
     this.goal = goal;
     if (visitedCache == null)
     {
         visitedCache = new HashedSet();
     }
     else
     {
         visitedCache.Clear();
     }
     if (pathes == null)
     {
         pathes = new List<ScoredPath>();
     }
     else
     {
         pathes.Clear();
     }
     visitedCache.Add(start);
     if (path == null)
     {
         path = new List<Vector2f>();
     }
     else
     {
         path.Clear();
     }
     path.Add(start);
     if (spath == null)
     {
         spath = new ScoredPath(0, path);
     }
     else
     {
         spath.score = 0;
         spath.path = path;
     }
     pathes.Add(spath);
     return Astar(field, flag);
 }