예제 #1
1
 public void OnHitRobotBehavior(HitRobotEvent evnt)
 {
     if (evnt.Bearing > -10 && evnt.Bearing < 10)
     {
         Robot.Fire(3);
     }
     if (evnt.IsMyFault)
     {
         Robot.TurnRight(10);
     }
 }
예제 #2
0
파일: Fire.cs 프로젝트: markthor/robocode
        /// <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);
        }
예제 #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();
 }
예제 #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);
     }
 }
예제 #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);
     }
 }
예제 #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);
     }
 }
예제 #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";
     }
 }
예제 #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;
 }
예제 #10
0
 public void OnHitRobotBehavior(HitRobotEvent evnt)
 {
     //throw new NotImplementedException();
 }
예제 #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();
     }
 }
예제 #12
0
 public void OnHitRobot(HitRobotEvent evnt)
 {
     count(evnt);
 }
예제 #13
0
 public override void OnHitRobot(HitRobotEvent evnt)
 {
     RobotBehavior.OnHitRobotBehavior(evnt);
 }
예제 #14
0
파일: RoboMom.cs 프로젝트: mokhan/irobot
 public override void OnHitRobot(HitRobotEvent evnt)
 {
     publisher.publish(evnt);
 }
예제 #15
0
 public override void OnHitRobot(HitRobotEvent evnt)
 {
     RunProgram(TableRexPrograms.onHitRobot);
 }
예제 #16
0
 public override void OnHitRobot(HitRobotEvent evnt)
 {
     hitBullet = 0;
 }
예제 #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();
            }
예제 #18
0
        public override void OnHitRobot(HitRobotEvent evnt)
        {

            if (AllowChange())
            {
                SwitchDirection();
                SwitchTurningDirection();
                SwitchTurning();
            }
        }
예제 #19
0
 public void OnHitRobotBehavior(HitRobotEvent evnt)
 {
 }
예제 #20
0
 /// <inheritdoc />
 public virtual void OnHitRobot(HitRobotEvent evnt)
 {
 }
예제 #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();
        }
예제 #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);
 }
예제 #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);
 }