public bool DoIt(AdvancedRobot robot) { if (!isSet) { isSet = true; m_startPoint = Geometry.MakePoint(robot.X, robot.Y); robot.SetAhead(10000); } if (robot.GetDistanceTo(m_startPoint) > Distance) { isSet = false; return false; } //robot.Out.WriteLine("Radius: {0}, Angle: {1}, Velocity: {2}, TurnRemaining: {3}", Radius, Angle, m_maxVelocity, robot.TurnRemaining); return true; }
/// <summary> /// Returns the position of the scanned robot based on new scan data for a scanned robot. /// </summary> /// <param name="scannedRobotEvent"> /// A ScannedRobotEvent event containing data about a scanned robot. /// </param> /// <param name="robot">Robot that calls this method.</param> /// <return>The position (x,y) of the scanned robot.</return> private PointF GetPosition(ScannedRobotEvent scannedRobotEvent, AdvancedRobot robot) { // Gets the distance to the scanned robot double distance = scannedRobotEvent.Distance; // Calculate the angle to the scanned robot (our robot heading + bearing to scanned robot) double angle = robot.HeadingRadians + scannedRobotEvent.BearingRadians; // Calculate the coordinates (x,y) of the scanned robot double x = robot.X + Math.Sin(angle) * distance; double y = robot.Y + Math.Cos(angle) * distance; // Return the position as a point (x,y) return new PointF((float)x, (float)y); }
/// <summary> /// Updates the scanned data based on new scan data for a scanned robot. /// </summary> /// <param name="scannedRobotEvent"> /// A ScannedRobotEvent event containing data about a scanned robot. /// </param> /// <param name="robot">Robot that calls this method.</param> public void Update(ScannedRobotEvent scannedRobotEvent, AdvancedRobot robot) { // Get the position of the scanned robot based on the ScannedRobotEvent PointF pos = GetPosition(scannedRobotEvent, robot); // Store the scanned position (x,y) scannedX = pos.X; scannedY = pos.Y; // Store the scanned velocity and heading scannedVelocity = scannedRobotEvent.Velocity; scannedHeading = scannedRobotEvent.HeadingRadians; }
internal double targetY; // predicated y coordinate to aim our gun at, when firing at the robot /// <summary> /// Creates a new robot data entry based on new scan data for a scanned robot. /// </summary> /// <param name="scannedRobotEvent"> /// A ScannedRobotEvent event containing data about a scanned robot. /// </param> /// <param name="robot">Robot that creates this data entry.</param> public RobotData(ScannedRobotEvent scannedRobotEvent, AdvancedRobot robot) { // Store the name of the scanned robot name = scannedRobotEvent.Name; // Updates all scanned facts like position, velocity, and heading Update(scannedRobotEvent, robot); // Initialize the coordinates (x,y) to fire at to the updated scanned position targetX = scannedX; targetY = scannedY; }
public OrbisBehavior(AdvancedRobot robot) { Robot = robot; }
public SpinBotBehavior(AdvancedRobot robot) { Robot = robot; }
public OgreTargeter(AdvancedRobot robot) { _robot = robot; }
public ShockWaveBehavior(AdvancedRobot robot) { Robot = robot; }
public TurnMultiplierLockScanner(AdvancedRobot robot) { _robot = robot; }
public WidthLockScanner(AdvancedRobot robot) { _robot = robot; }
public AnotherTargeter(AdvancedRobot robot) { _robot = robot; }