Пример #1
0
        public override void OnBulletHitBullet(BulletHitBulletEvent evnt)
        {
            var bullets = blackboard.GetValue <List <Bullet> >(BB.bulletsKey);

            bullets.Remove(evnt.Bullet);
            blackboard.SetValue(BB.bulletsKey, bullets);
        }
Пример #2
0
        public override void OnBulletHitBullet(BulletHitBulletEvent e)
        {
            BulletWave hitWave = null;

            foreach (var ew in enemyBullets)
            {
                if (Math.Abs(ew.GetTraveledDistance(Time) -
                             Helper.GetDistance(e.HitBullet.X, e.HitBullet.Y, ew.StartX, ew.StartY)) < 0.001 &&
                    Math.Abs(Helper.GetBulletVelocity(e.HitBullet.Power) - ew.Velocity) < 0.001)
                {
                    hitWave = ew;
                    break;
                }
            }

            if (hitWave != null)
            {
                LogHit(hitWave, e.HitBullet.X, e.HitBullet.Y);
                enemyBullets.Remove(hitWave);
            }

            foreach (var bullet in myBullets)
            {
                if (Math.Abs(bullet.GetTraveledDistance(Time) - Helper.GetDistance(e.HitBullet.X, e.HitBullet.Y, bullet.StartX, bullet.StartY)) < 0.001 &&
                    Math.Abs(e.HitBullet.Power - bullet.Power) < 0.001 && Math.Abs(e.Bullet.HeadingRadians - bullet.Angle) < 0.001)
                {
                    bullet.CheckHit(e.HitBullet.X, e.HitBullet.Y, Time); //maybe add more weight
                    break;
                }
            }
        }
Пример #3
0
 public double?RegisterBulletHitBullet(BulletHitBulletEvent evnt)
 {
     if (_queue.Count > 0)
     {
         return(_queue.Peek().GetGuessFactor(evnt));
     }
     return(null);
 }
Пример #4
0
 public override void OnBulletHitBullet(BulletHitBulletEvent evnt)
 {
     for (int i = 0; i < behaviors.Count; ++i)
     {
         var behavior = behaviors[i];
         behavior.OnBulletHitBullet(evnt);
     }
 }
Пример #5
0
        public double?GetGuessFactor(BulletHitBulletEvent bulletHitBulletEvent)
        {
            // todo
            double gf = new Angle(bulletHitBulletEvent.HitBullet.Heading - _initialEnemyDirect.Heading.Degrees).Degrees180 /
                        (2.0 * _maxEscapeAngle);

            return(gf);
        }
Пример #6
0
        public void OnBulletHitBullet(BulletHitBulletEvent evnt)
        {
            IEnemy enemy = SafeGetEnemy(evnt.Bullet.Name);

            if (enemy != null)
            {
                enemy.RegisterBulletHitBullet(evnt);
            }
        }
Пример #7
0
        public void WhenOnBulletHitBulletIsCalled()
        {
            var b1 = RandomHelper.RandomBullet();

            var b2 = RandomHelper.RandomBullet();

            var e = new BulletHitBulletEvent(b1, b2);

            _brain.OnBulletHitBullet(e);
        }
Пример #8
0
 public override void OnBulletHitBullet(BulletHitBulletEvent evnt)
 {
     base.OnBulletHitBullet(evnt);
     bulletHitBulletCount++;
     if (bulletHitBulletCount > 2)
     {
         this.blackBoard.Power = 1;
         bulletHitBulletCount  = 0;
     }
 }
Пример #9
0
 public void RegisterBulletHitBullet(BulletHitBulletEvent evnt)
 {
     if (Waves != null)
     {
         double?gf = Waves.RegisterBulletHitBullet(evnt);
         if (_enemyGuessFactorStats != null && gf != null)
         {
             _enemyGuessFactorStats.Update(gf.Value);
         }
     }
 }
Пример #10
0
 public override void OnBulletHitBullet(BulletHitBulletEvent evnt)
 {
     SetTurnLeft(45);
     SetAhead(150);
     Execute();
 }
Пример #11
0
 public void OnBulletHitBullet(BulletHitBulletEvent evnt)
 {
     _context.OnBulletHitBullet(evnt);
 }
Пример #12
0
 public override void OnBulletHitBullet(BulletHitBulletEvent evnt)
 {
     SetTurnLeft(15);
     Fire(1);
 }
Пример #13
0
 public void OnBulletHitBullet(BulletHitBulletEvent evnt)
 {
     count(evnt);
 }
Пример #14
0
 public override void OnBulletHitBullet(BulletHitBulletEvent e)
 {
     base.OnBulletHitBullet(e);
 }
Пример #15
0
 public virtual void OnBulletHitBullet(BulletHitBulletEvent evnt)
 {
 }
Пример #16
0
 public override void OnBulletHitBullet(BulletHitBulletEvent evnt)
 {
     _brain.OnBulletHitBullet(evnt);
 }
Пример #17
0
 public void OnBulletHitBullet(BulletHitBulletEvent evnt)
 {
     Enemies.OnBulletHitBullet(evnt);
 }