示例#1
0
 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;
 }
示例#2
0
            /// <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);
            }
示例#3
0
 /// <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;
 }
示例#4
0
            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;
            }
示例#5
0
 public OrbisBehavior(AdvancedRobot robot)
 {
     Robot = robot;
 }
示例#6
0
 public SpinBotBehavior(AdvancedRobot robot)
 {
     Robot = robot;
 }
 public OgreTargeter(AdvancedRobot robot)
 {
     _robot = robot;
 }
示例#8
0
 public ShockWaveBehavior(AdvancedRobot robot)
 {
     Robot = robot;
 }
 public TurnMultiplierLockScanner(AdvancedRobot robot)
 {
     _robot = robot;
 }
 public WidthLockScanner(AdvancedRobot robot)
 {
     _robot = robot;
 }
 public AnotherTargeter(AdvancedRobot robot)
 {
     _robot = robot;
 }