public void WhenOnHitByBulletIsCalled() { var b = RandomHelper.RandomBullet(); var e = new HitByBulletEvent(RandomHelper.RandomBearing(), b); _brain.OnHitByBullet(e); }
/// <summary> /// zdarzenie jak zostanę trafiony /// </summary> /// <param name="evnt"></param> public override void OnHitByBullet(HitByBulletEvent e) { if (!_ACTION_START) { _ACTION_START = true; SetTankForCorner(e.Heading + 180); } CustomLog("TRAFILI MNIE. bearing: " + e.Bearing.ToString("F2") + " heading: " + e.Heading.ToString("F2") + " bearing radian: " + e.BearingRadians.ToString("F2") + " heading radian: " + e.HeadingRadians.ToString("F2")); //ustaw broń do strzelania //TurnRadarRight(360); SetGunForHit(e.Heading + 180); Fire(1); if (_ESCAPE_FROM_BULLET_AHEAD_OR_BACK == 0) { Back(200); _ESCAPE_FROM_BULLET_AHEAD_OR_BACK = 1; } else { Ahead(200); _ESCAPE_FROM_BULLET_AHEAD_OR_BACK = 0; } _IS_TARGET = false; Scan(); }
public override void onHitByBullet(HitByBulletEvent @event) { // maybe we should be going right instead? var _turnLeft = 90 - @event.getBearing(); var _turnRight = -(90 + @event.getBearing()); Console.WriteLine("onHitByBullet.bearing: " + @event.getBearing()); Console.WriteLine("onHitByBullet._turnLeft: " + _turnLeft); Console.WriteLine("onHitByBullet._turnRight: " + _turnRight); if (_turnLeft < _turnRight) { this.turnLeft(_turnLeft); } else { this.turnLeft(_turnRight); } this.ahead(40); if (_turnLeft < _turnRight) { this.turnRight(15); } else { this.turnLeft(15); } this.ahead(40); }
public override void OnHitByBullet(HitByBulletEvent e) { // If the _enemyWaves collection is empty, we must have missed the // detection of this wave somehow. BulletWave hitWave = null; foreach (var ew in enemyBullets) { if (Math.Abs(ew.GetTraveledDistance(Time) - Helper.GetDistance(X, Y, ew.StartX, ew.StartY)) <= _radius && Math.Abs(Helper.GetBulletVelocity(e.Bullet.Power) - ew.Velocity) < 0.001) { hitWave = ew; break; } } if (hitWave != null) { LogHit(hitWave, e.Bullet.X, e.Bullet.Y); enemyBullets.Remove(hitWave); } if (medKitLocked) { SetBackAsFront(HeadingRadians + Math.PI, rnd.Next(50, 100)); } }
public override void OnHitByBullet(HitByBulletEvent evnt) { if (!robots.ContainsKey(evnt.Name)) { return; } var enemy = robots[evnt.Name]; enemy.Hits++; if (enemy.Distance > DISTANCE_THRESHOLD && enemy.Time < 500) { return; } if (LastBulletHit == null && CurrentPhase == RoboPhase.MeetAndGreet) { LastBulletHit = evnt; CurrentPhase = RoboPhase.KillItWithFire; TargetEnemyName = evnt.Name; } else if (LastBulletHit?.Name == evnt.Name) { LastBulletHit = evnt; } base.OnHitByBullet(evnt); }
public override void OnHitByBullet(HitByBulletEvent evnt) { for (int i = 0; i < behaviors.Count; ++i) { var behavior = behaviors[i]; behavior.OnHitByBullet(evnt); } }
public override void OnHitByBullet(HitByBulletEvent e) { BulletForces.Add(new ForcedPoint(this.MyBot.Position.X, this.MyBot.Position.Y, 5000) { Color = Color.Red, AffectTurn = 30 }); }
/// <summary> /// onHitByBullet: Turn perpendicular to the bullet, and move a bit. /// </summary> public override void OnHitByBullet(HitByBulletEvent e) { TurnRight(Utils.NormalRelativeAngleDegrees(90 - (Heading - e.Heading))); Ahead(dist); dist *= -1; Scan(); }
public double?RegisterHitByBullet(HitByBulletEvent evnt) { if (_queue.Count > 0) { return(_queue.Peek().GetGuessFactor(evnt)); } return(null); }
public double?GetGuessFactor(HitByBulletEvent hitByBulletEvent) { // todo double gf = new Angle(hitByBulletEvent.Heading - _initialEnemyDirect.Heading.Degrees).Degrees180 / (2.0 * _maxEscapeAngle); return(gf); }
private void ProcessEvents() { m_bMoveComplete = false; m_bTurnComplete = false; if (m_pEvents.Count > 0) { if (m_pEvents[0] is HitWallEvent) { HitWallEvent pEvent = (HitWallEvent)m_pEvents[0]; m_pEvents.Clear(); OnHitWall(pEvent); m_bMoveComplete = true; return; } if (m_pEvents[0] is HitRobotEvent) { HitRobotEvent pEvent = (HitRobotEvent)m_pEvents[0]; m_pEvents.Clear(); OnHitRobot(pEvent); m_bMoveComplete = true; return; } if (m_pEvents[0] is ScannedRobotEvent) { ScannedRobotEvent pEvent = (ScannedRobotEvent)m_pEvents[0]; m_pEvents.Clear(); OnScannedRobot(pEvent); return; } if (m_pEvents[0] is BulletMissedEvent) { BulletMissedEvent pEvent = (BulletMissedEvent)m_pEvents[0]; m_pEvents.Clear(); OnBulletMissed(pEvent); return; } if (m_pEvents[0] is BulletHitEvent) { BulletHitEvent pEvent = (BulletHitEvent)m_pEvents[0]; m_pEvents.Clear(); OnBulletHit(pEvent); return; } if (m_pEvents[0] is HitByBulletEvent) { HitByBulletEvent pEvent = (HitByBulletEvent)m_pEvents[0]; m_pEvents.Clear(); OnHitByBullet(pEvent); return; } } }
public override void OnHitByBullet(HitByBulletEvent e) { double absoluteBearing = Heading + e.Bearing; double bearingFromGun = Utils.NormalRelativeAngleDegrees(absoluteBearing - GunHeading); TurnGunRight(bearingFromGun); EsquivaTiros(); WaitFor(new GunTurnCompleteCondition(this)); }
// Robot event handler, when the robot gets hit by a bullet public override void OnHitByBullet(HitByBulletEvent e) { BodyColor = Color.Red; //double bearing = e.Bearing; //if (Energy < energyLimit) //{ // TurnRight(-bearing); //} }
public void OnHitByBullet(HitByBulletEvent evnt) { IEnemy enemy = SafeGetEnemy(evnt.Name); if (enemy != null) { enemy.RegisterHitByBullet(evnt); } }
public override void OnHitByBullet(HitByBulletEvent evento) { Console.WriteLine($"{Name} foi alvejado por {evento.Name} com {evento.Power} de dano!!"); //Movimentação de defesa ao receber um tiro Back(100); TurnLeft(45); Scan(); }
public void RegisterHitByBullet(HitByBulletEvent evnt) { if (Waves != null) { double?gf = Waves.RegisterHitByBullet(evnt); if (_enemyGuessFactorStats != null && gf != null) { _enemyGuessFactorStats.Update(gf.Value); } } }
//void OnHitWall(HitWallEvent evnt) //{ // direction *= -1; //} public void OnHitByBullet(HitByBulletEvent e) { sucessiveShoots++; timeAct = Time; TurnRight(Utils.NormalRelativeAngleDegrees(90 - (Heading - e.Heading))); // sempre correr em 90 graus ao inimigo Ahead(distanceToMoveWhenShooted); distanceToMoveWhenShooted *= -1; //talvez seja melhor sem isso. Scan(); //continua aqui }
public override void OnHitByBullet(HitByBulletEvent evnt) { base.OnHitByBullet(evnt); //etTurnRadarRight(360); incomingHitss++; if (incomingHitss > 0 && !blackBoard.DirectHit || Time % 100 == 0) { // currentBehaviour = moveBehaviour; blackBoard.DirectHit = true; incomingHitss = 0; } }
public override void OnHitByBullet(HitByBulletEvent evnt) { base.OnHitByBullet(evnt); double num = evnt.Bearing; base.TurnLeft(num); for (int i = 0; i > 2; i++) { base.Fire(1.0); } base.TurnGunRight(num); }
} // onscannedrobot public override void OnHitByBullet(HitByBulletEvent e) { armaDisparo += 1; if (tipoTiro == 1) { armaFrenteAcerto += 1; armaFrenteDisparo += 1; } else if (tipoTiro == 2) { armaDiretoDisparo += 1; armaDiretoAcerto += 1; } } //onhitbybullet
/// <summary> /// We were hit! Turn perpendicular to the bullet, /// so our seesaw might avoid a future shot. /// In addition, draw orange circles where we were hit. /// </summary> public override void OnHitByBullet(HitByBulletEvent e) { // demonstrate feature of debugging properties on RobotDialog DebugProperty["lastHitBy"] = e.Name + " with power of bullet " + e.Power + " at time " + Time; // show how to remove debugging property DebugProperty["lastScannedRobot"] = null; // gebugging by painting to battle view IGraphics g = Graphics; g.DrawEllipse(Pens.Orange, (int)(X - 55), (int)(Y - 55), 110, 110); g.DrawEllipse(Pens.Orange, (int)(X - 56), (int)(Y - 56), 112, 112); g.DrawEllipse(Pens.Orange, (int)(X - 59), (int)(Y - 59), 118, 118); g.DrawEllipse(Pens.Orange, (int)(X - 60), (int)(Y - 60), 120, 120); TurnLeft(90 - e.Bearing); }
public override void OnRobotDeath(RobotDeathEvent evnt) { Console.WriteLine("Died: " + evnt.Name); if (TargetEnemyName == evnt.Name || LastBulletHit?.Name == evnt.Name) { if (robots.ContainsKey(evnt.Name)) { robots.Remove(evnt.Name); } LastBulletHit = null; TargetEnemyName = null; CurrentPhase = RoboPhase.WallRush; } base.OnRobotDeath(evnt); }
public override void onHitByBullet(HitByBulletEvent @event) { // maybe we should be going right instead? var _turnLeft = 90 - @event.getBearing(); var _turnRight = -(90 + @event.getBearing()); Console.WriteLine("onHitByBullet.bearing: " + @event.getBearing()); Console.WriteLine("onHitByBullet._turnLeft: " + _turnLeft); Console.WriteLine("onHitByBullet._turnRight: " + _turnRight); if (_turnLeft < _turnRight) this.turnLeft(_turnLeft); else this.turnLeft(_turnRight); this.ahead(40); if (_turnLeft < _turnRight) this.turnRight(15); else this.turnLeft(15); this.ahead(40); }
public override void OnHitByBullet(HitByBulletEvent evnt) { base.OnHitByBullet(evnt); }
public virtual void OnHitByBullet(HitByBulletEvent e) { }
// O que fazer quando você for atingido por uma munição public override void OnHitByBullet(HitByBulletEvent evnt) { SetBack(30); SetAhead(20); Execute(); }
public void OnHitByBullet(HitByBulletEvent evnt) { // TODO BUG: evnt.Name is returning actual name rather than just a number! //Out.WriteLine(string.Format("Hit by: {0}", evnt.Name)); _context.OnHitByBullet(evnt); }
public void OnHitByBullet(HitByBulletEvent evnt) { count(evnt); }
public override void onHitByBullet(HitByBulletEvent @event) { GotTarget = false; turnLeft(90 - @event.getBearing()); }
public override void OnHitByBullet(HitByBulletEvent evnt) { SetTurnRight(60); SetAhead(150); Execute(); }
/// <summary> /// We were hit! Turn perpendicular to the bullet, /// so our seesaw might avoid a future shot. /// </summary> public override void OnHitByBullet(HitByBulletEvent e) { TurnLeft(90 - e.Bearing); }
public override void OnHitByBullet(HitByBulletEvent e) { // Turn to confuse the other robot TurnRate = 5; }