Esempio n. 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);
                */
            }
        }
Esempio n. 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();
            }
Esempio n. 3
0
 public override void OnHitWall(HitWallEvent evnt)
 {
     hitBullet++;
     if (hitBullet == 3)
     {
         hitBullet = 0;
         Ahead(180);
         Back(80);
     }
 }
Esempio n. 4
0
 public void OnHitWallBehavior(HitWallEvent evnt)
 {
     turnRight = !turnRight;
     PointToCenter();
     Robot.SetAhead(500);
     Robot.SetTurnRight(45);
     //Robot.Stop();
     //PointToCenter();
     //Robot.Resume();
 }
Esempio n. 5
0
 public void OnHitWallBehavior(HitWallEvent evnt)
 {
     RunBehavior();
 }
Esempio n. 6
0
 /// <summary>
 /// onHitWall:  Handle collision with wall.
 /// </summary>
 public override void OnHitWall(HitWallEvent e)
 {
     // Bounce off!
     reverseDirection();
 }
Esempio n. 7
0
 public void OnHitWall(HitWallEvent evnt)
 {
     count(evnt);
 }
Esempio n. 8
0
 public override void OnHitWall(HitWallEvent e)
 {
     // Move away from the wall
     VelocityRate = (-1*VelocityRate);
 }
Esempio n. 9
0
 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);
 }
Esempio n. 10
0
 public override void OnHitWall(HitWallEvent e)
 {
     reverseDirection();
 }
Esempio n. 11
0
 /// <inheritdoc />
 public virtual void OnHitWall(HitWallEvent evnt)
 {
 }
Esempio n. 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;
 }
Esempio n. 14
0
 public override void OnHitWall(HitWallEvent e)
 {
     // Move away from the wall
     //VelocityRate = (-1 * VelocityRate);
     //SetTurnRight(30);
 }
Esempio n. 15
0
 public override void OnHitWall(HitWallEvent evnt)
 {
     if (AllowChange())
     {
         SwitchDirection();
         SwitchTurningDirection();
         SwitchTurning();
     }
 }
Esempio n. 16
0
 public override void OnHitWall(HitWallEvent evnt)
 {
     publisher.publish(evnt);
 }
Esempio n. 17
0
 public void OnHitWallBehavior(HitWallEvent evnt)
 {
     //throw new NotImplementedException();
 }
Esempio n. 18
0
 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
 }
Esempio n. 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();
            }
Esempio n. 20
0
 public override void OnHitWall(HitWallEvent evnt)
 {
     RunProgram(TableRexPrograms.onHitWall);
 }
Esempio n. 21
0
 /// <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);
 }
Esempio n. 22
0
 public override void OnHitWall(HitWallEvent evnt)
 {
     RobotBehavior.OnHitWallBehavior(evnt);
 }