public PursueNode(PursueNode parent, Location origin, Location leave, int maxDist, Vector2 targetDir, Vector2 dir) : base(parent) { G = (parent == null) ? 0 : (parent.G + 1); this.maxDist = maxDist; this.origin = origin; this.leave = leave; this.targetDir = targetDir; this.dir = dir; }
public override Node ChildNode(Location loc) { Vector2 newDir = loc.ToVector() - CurLocation.ToVector(); PursueNode n = new PursueNode(this, origin, leave, maxDist, targetDir, newDir) { CurLocation = loc, Obstacles = Obstacles, }; return(n); }
public override Queue <Location> ExtractPlan(Subject s, Intention i, Beliefs b, List <Location> path) { Queue <Location> plan = new Queue <Location>(); Location dest = new Location(); dest = s.Location; PursueNode fNode = new PursueNode(null, b.Agents['0'].Location, dest, 10, b.Agents['0'].Direction, s.Direction) { CurLocation = new Location(s.Location), Obstacles = new HashSet <Location>(b.Obstacles.Keys) }; fNode.Obstacles.UnionWith(Util.GetDynamicObstacles(s.ID, s.Location, b)); plan = Planner.Search(fNode); return(plan); }
public override bool Equals(object obj) { if (ReferenceEquals(null, obj)) { return(false); } if (ReferenceEquals(this, obj)) { return(true); } if (obj.GetType() != this.GetType()) { return(false); } PursueNode other = (PursueNode)obj; return(!System.Object.ReferenceEquals(null, CurLocation) && CurLocation.Equals(other.CurLocation) && dir.Equals(other.dir)); }