Exemple #1
0
        public override void OnHitWall(HitWallEvent evnt)
        {
            if (state == myState.Start)
            {
                if ((this.Y > BattleFieldHeight * 0.5 && this.X > BattleFieldWidth * 0.5) || (this.Y < BattleFieldHeight * 0.5 && this.X < BattleFieldWidth * 0.5))
                {
                    TurnLeft(90);
                    TurnGunLeft(90);
                }
                else
                {
                    TurnRight(90);
                    TurnGunRight(90);
                }

                state = myState.FollowinWall;
            }
            else
            {
                invertDir = !invertDir;
                /*
                if ((this.Y > BattleFieldHeight * 0.5 && this.X > BattleFieldWidth * 0.5) || (this.Y < BattleFieldHeight * 0.5 && this.X < BattleFieldWidth * 0.5))
                    TurnLeft(180);
                else
                    TurnRight(180);
                */
            }
        }
Exemple #2
0
            public void OnHitWall(HitWallEvent evnt)
            {
                double angle = robot.peer.GetBodyHeading() + evnt.BearingRadians;

                robot.hitWallAngle   = (int)(Utils.ToDegrees(Utils.NormalAbsoluteAngle(angle)) + 0.5);
                robot.hitWallBearing = (int)(evnt.Bearing + 0.5);
                robot.OnHitWall();
            }
Exemple #3
0
 public override void OnHitWall(HitWallEvent evnt)
 {
     hitBullet++;
     if (hitBullet == 3)
     {
         hitBullet = 0;
         Ahead(180);
         Back(80);
     }
 }
 public void OnHitWallBehavior(HitWallEvent evnt)
 {
     turnRight = !turnRight;
     PointToCenter();
     Robot.SetAhead(500);
     Robot.SetTurnRight(45);
     //Robot.Stop();
     //PointToCenter();
     //Robot.Resume();
 }
 public void OnHitWallBehavior(HitWallEvent evnt)
 {
     RunBehavior();
 }
Exemple #6
0
 /// <summary>
 /// onHitWall:  Handle collision with wall.
 /// </summary>
 public override void OnHitWall(HitWallEvent e)
 {
     // Bounce off!
     reverseDirection();
 }
 public void OnHitWall(HitWallEvent evnt)
 {
     count(evnt);
 }
Exemple #8
0
 public override void OnHitWall(HitWallEvent e)
 {
     // Move away from the wall
     VelocityRate = (-1*VelocityRate);
 }
 public override void OnHitWall(HitWallEvent e)
 {
     // when the radar is turned here, at least another robot should be Scanned
     // but Event should not be dispatched because we are in handler with higher priority   
     TurnRadarRight(360);
 }
Exemple #10
0
 public override void OnHitWall(HitWallEvent e)
 {
     reverseDirection();
 }
Exemple #11
0
 /// <inheritdoc />
 public virtual void OnHitWall(HitWallEvent evnt)
 {
 }
Exemple #12
0
 public override void OnHitWall(HitWallEvent evnt)
 {
     SetAhead(rnd.Next(10, 500) * (ReverseTurn * -1));
     SetTurnLeft(rnd.Next(45, 120));
     SetTurnGunRight(10);
     Execute();
 }
 /// <summary>
 /// Handle wall hit event.
 /// Use radius sampling movement to ensure the next move position will move the robot away from the wall
 /// </summary>
 /// <param name="evnt"></param>
 /// <inheritdoc/>
 public override void OnHitWall(HitWallEvent evnt)
 {
     this.currentMovementMode = MovementMode.RadiusSampling;
     this.collisionTime = evnt.Time;
 }
Exemple #14
0
 public override void OnHitWall(HitWallEvent e)
 {
     // Move away from the wall
     //VelocityRate = (-1 * VelocityRate);
     //SetTurnRight(30);
 }
 public override void OnHitWall(HitWallEvent evnt)
 {
     if (AllowChange())
     {
         SwitchDirection();
         SwitchTurningDirection();
         SwitchTurning();
     }
 }
Exemple #16
0
 public override void OnHitWall(HitWallEvent evnt)
 {
     publisher.publish(evnt);
 }
 public void OnHitWallBehavior(HitWallEvent evnt)
 {
     //throw new NotImplementedException();
 }
 public override void OnHitWall(HitWallEvent e)
 {
     IsInterruptible = (true); // make sure that the Event handler can be interrupted and restarted
     TurnRadarRight(360); // when the radar is turned here, at least another robot should be Scanned
 }
Exemple #19
0
            public void OnHitWall(HitWallEvent evnt)
            {
                double angle = robot.peer.GetBodyHeading() + evnt.BearingRadians;

                robot.hitWallAngle = (int) (Utils.ToDegrees(Utils.NormalAbsoluteAngle(angle)) + 0.5);
                robot.hitWallBearing = (int) (evnt.Bearing + 0.5);
                robot.OnHitWall();
            }
Exemple #20
0
 public override void OnHitWall(HitWallEvent evnt)
 {
     RunProgram(TableRexPrograms.onHitWall);
 }
 /// <summary>
 /// Handle running into a wall (basically, reverse direction and keep going).
 /// </summary>
 /// <param name="evnt">The <c>HitWallEvent</c> args containing data about the wall that was hit.</param>
 public override void OnHitWall(HitWallEvent evnt)
 {
     _treads.ReactToWall(evnt);
 }
 public override void OnHitWall(HitWallEvent evnt)
 {
     RobotBehavior.OnHitWallBehavior(evnt);
 }