示例#1
0
 private void Tank_HitKolobokEvent(object sender, EventArgs e)
 {
     if (e is HitTankEventArgs)
     {
         HitTankEventArgs hitTankEventArgs = e as HitTankEventArgs;
         for (int i = 0; i < hitTankEventArgs.positionsOfShot.Count; i++)
         {
             if (IsHitBorder(hitTankEventArgs.positionsOfShot[i].CurrentPosition))
             {
                 hitTankEventArgs.positionsOfShot[i] = null;
                 hitTankEventArgs.positionsOfShot.Remove(hitTankEventArgs.positionsOfShot[i]);
                 IsGameOver = true;
             }
         }
     }
 }
示例#2
0
 private void Shot_HitTankEvent(object sender, EventArgs e)
 {
     if (e is HitTankEventArgs)
     {
         HitTankEventArgs hitTankEventArgs = e as HitTankEventArgs;
         for (int i = 0; i < hitTankEventArgs.positionsOfShot.Count; i++)
         {
             if (IsHitBorder(hitTankEventArgs.positionsOfShot[i].CurrentPosition))
             {
                 positionOfKill = CurrentPosition;
                 CreateRandomLocation();
                 hitTankEventArgs.positionsOfShot[i] = null;
                 hitTankEventArgs.positionsOfShot.Remove(hitTankEventArgs.positionsOfShot[i]);
             }
         }
     }
 }
示例#3
0
        private void OnHitKolobok(HitTankEventArgs e)
        {
            EventHandler hitKolobokEvent = HitKolobokEvent;

            hitKolobokEvent?.Invoke(this, e);
        }
示例#4
0
        private void HitKolobok()
        {
            HitTankEventArgs hitTankEventArgs = new HitTankEventArgs(positionsOfShot);

            OnHitKolobok(hitTankEventArgs);
        }