Exemplo n.º 1
1
 public void OnHitRobotBehavior(HitRobotEvent evnt)
 {
     if (evnt.Bearing > -10 && evnt.Bearing < 10)
     {
         Robot.Fire(3);
     }
     if (evnt.IsMyFault)
     {
         Robot.TurnRight(10);
     }
 }
Exemplo n.º 2
0
        /// <summary>
        ///   onHitRobot:  Aim at it.  Fire Hard!
        /// </summary>
        public override void OnHitRobot(HitRobotEvent e)
        {
            double turnGunAmt = Utils.NormalRelativeAngleDegrees(e.Bearing + Heading - GunHeading);

            TurnGunRight(turnGunAmt);
            Fire(3);
        }
Exemplo n.º 3
0
 public void OnHitRobotBehavior(HitRobotEvent evnt)
 {
     if (Robot.GunHeat == 0) { Robot.SafeFire(3, evnt.Name); }
     Robot.Back(100);
     if (Robot.GunHeat == 0) { Robot.SafeFire(3, evnt.Name); }
     Robot.Scan();
 }
Exemplo n.º 4
0
 /// 
 ///<summary>
 ///  onHitRobot:  If it's our fault, we'll stop turning and moving,
 ///  so we need to turn again to keep spinning.
 ///</summary>
 public override void OnHitRobot(HitRobotEvent e)
 {
     if (e.Bearing > -10 && e.Bearing < 10)
     {
         Fire(3);
     }
     if (e.IsMyFault)
     {
         TurnRight(10);
     }
 }
Exemplo n.º 5
0
 /// 
 ///<summary>
 ///  onHitRobot:  If it's our fault, we'll stop turning and moving,
 ///  so we need to turn again to keep spinning.
 ///</summary>
 public override void OnHitRobot(HitRobotEvent e)
 {
     if (e.Bearing > -10 && e.Bearing < 10)
     {
         Fire(3);
     }
     if (e.IsMyFault)
     {
         //VelocityRate = (-1 * VelocityRate);
         //SetTurnRight(10);
     }
 }
Exemplo n.º 6
0
 /// <summary>
 ///   onHitRobot:  Move away a bit.
 /// </summary>
 public override void OnHitRobot(HitRobotEvent e)
 {
     // If he's in front of us, set back up a bit.
     if (e.Bearing > -90 && e.Bearing < 90)
     {
         Back(100);
     } // else he's in back of us, so set ahead a bit.
     else
     {
         Ahead(100);
     }
 }
Exemplo n.º 7
0
 public override void OnHitRobot(HitRobotEvent e)
 {
     if (e.Bearing > -10 && e.Bearing < 10)
     {
         Fire(Rules.MAX_BULLET_POWER);
     }
     if (e.IsMyFault)
     {
         MaxVelocity = 8;
         TurnRight(100);
         WaitFor(new TurnCompleteCondition(this));
         SetAhead(100);
     }
     if (e.Energy < 50 && Energy > 50)
     {
         mode = "vuelticas";
     }
 }
Exemplo n.º 8
0
        /// <summary>
        ///   onHitRobot:  Turn to face robot, fire hard, and ram him again!
        /// </summary>
        public override void OnHitRobot(HitRobotEvent e)
        {
            if (e.Bearing >= 0)
            {
                turnDirection = 1;
            }
            else
            {
                turnDirection = -1;
            }
            TurnRight(e.Bearing);

            // Determine a shot that won't kill the robot...
            // We want to ram him instead for bonus points
            if (e.Energy > 16)
            {
                Fire(3);
            }
            else if (e.Energy > 10)
            {
                Fire(2);
            }
            else if (e.Energy > 4)
            {
                Fire(1);
            }
            else if (e.Energy > 2)
            {
                Fire(.5);
            }
            else if (e.Energy > .4)
            {
                Fire(.1);
            }
            Ahead(40); // Ram him again!
        }
 /// <summary>
 /// Handle robot hit event.
 /// Use anti-gravity movement to move away from the hit robot
 /// </summary>
 /// <param name="evnt"></param>
 /// <inheritdoc/>
 public override void OnHitRobot(HitRobotEvent evnt)
 {
     this.currentMovementMode = MovementMode.AntiGravity;
     this.collisionTime = evnt.Time;
 }
Exemplo n.º 10
0
 public void OnHitRobotBehavior(HitRobotEvent evnt)
 {
     //throw new NotImplementedException();
 }
Exemplo n.º 11
0
 /// <summary>
 ///   onHitRobot:  Back up!
 /// </summary>
 public override void OnHitRobot(HitRobotEvent e)
 {
     // If we're moving the other robot, reverse!
     if (e.IsMyFault)
     {
         reverseDirection();
     }
 }
Exemplo n.º 12
0
 public void OnHitRobot(HitRobotEvent evnt)
 {
     count(evnt);
 }
Exemplo n.º 13
0
 public override void OnHitRobot(HitRobotEvent evnt)
 {
     RobotBehavior.OnHitRobotBehavior(evnt);
 }
Exemplo n.º 14
0
 public override void OnHitRobot(HitRobotEvent evnt)
 {
     publisher.publish(evnt);
 }
Exemplo n.º 15
0
 public override void OnHitRobot(HitRobotEvent evnt)
 {
     RunProgram(TableRexPrograms.onHitRobot);
 }
Exemplo n.º 16
0
 public override void OnHitRobot(HitRobotEvent evnt)
 {
     hitBullet = 0;
 }
Exemplo n.º 17
0
            public void OnHitRobot(HitRobotEvent evnt)
            {
                double angle = robot.peer.GetBodyHeading() + evnt.BearingRadians;

                robot.hitRobotAngle = (int) (Utils.ToDegrees(Utils.NormalAbsoluteAngle(angle)) + 0.5);
                robot.hitRobotBearing = (int) (evnt.Bearing + 0.5);
                robot.OnHitRobot();
            }
Exemplo n.º 18
0
        public override void OnHitRobot(HitRobotEvent evnt)
        {

            if (AllowChange())
            {
                SwitchDirection();
                SwitchTurningDirection();
                SwitchTurning();
            }
        }
Exemplo n.º 19
0
 public void OnHitRobotBehavior(HitRobotEvent evnt)
 {
 }
Exemplo n.º 20
0
 /// <inheritdoc />
 public virtual void OnHitRobot(HitRobotEvent evnt)
 {
 }
Exemplo n.º 21
0
        public override void OnHitRobot(HitRobotEvent evnt)
        {
            if (!(evnt.IsMyFault))
            {
                ReverseTurn *= -1;
                SetAhead(rnd.Next(100, 200) * ReverseTurn);
                Execute();
                return;
            }

            // Calculate exact location of the robot
            double absoluteBearing = Heading + evnt.Bearing;
            double bearingFromGun = Robocode.Util.Utils.NormalRelativeAngleDegrees(absoluteBearing - GunHeading);
            SetTurnGunRight(Robocode.Util.Utils.NormalRelativeAngleDegrees(bearingFromGun));
            Execute();
        }
Exemplo n.º 22
0
 /// <summary>
 ///   onHitRobot:  Set him as our new target
 /// </summary>
 public override void OnHitRobot(HitRobotEvent e)
 {
     // Only print if he's not already our target.
     if (trackName != null && trackName != e.Name)
     {
         Out.WriteLine("Tracking " + e.Name + " due to collision");
     }
     // Set the target
     trackName = e.Name;
     // Back up a bit.
     // Note:  We won't get scan events while we're doing this!
     // An AdvancedRobot might use setBack(); Execute();
     gunTurnAmt = Utils.NormalRelativeAngleDegrees(e.Bearing + (Heading - RadarHeading));
     TurnGunRight(gunTurnAmt);
     Fire(3);
     Back(50);
 }
Exemplo n.º 23
0
 /// <summary>
 /// Handle crashing into another robot.  Record the enemy robot's energy state (<c>AdvancedRobot</c>s take 
 /// damage from collisions) and attempt to move away from the enemy robot.
 /// </summary>
 /// <param name="evnt">The <c>HitRobotEvent</c> args containing data about the collision.</param>
 public override void OnHitRobot(HitRobotEvent evnt)
 {
     _enemyPreviousEnergy = evnt.Energy;
     _treads.ReactToRobotImpact(evnt);
 }