/// <summary> /// Navigate away from target position x, y /// </summary> public virtual Movement NaviAwayTarget(double x, double y, int maxSpd = 70, int rotateTime = 250) { this.result = base.GetWaypointAway(x, y); var spd = Min(this.result.speedLimit, maxSpd * this.result.speedRatio); var mv = handle.Move2Target(this.result.waypoint, maxSpd: spd, rotateTime: rotateTime, tolerance: 8); return(mv); }
/// <summary> /// Navigate to target position with x, y /// </summary> public virtual Movement Navi2Target(double x, double y, int maxSpd = 70, int rotateTime = 250, double tolerance = 20) { this.result = base.GetWaypointTo(x, y); var spd = Min(this.result.speedLimit, maxSpd * this.result.speedRatio); var mv = handle.Move2Target(this.result.waypoint, maxSpd: spd, rotateTime: rotateTime, tolerance: 8 ); if (ego.pos.distTo(new Vector(x, y)) <= tolerance && mv.reached) { return(mv); } else { mv.reached = false; return(mv); } }