Example #1
0
 public void Move(KolobokEventArgs kolobokEventArgs)
 {
     if (kolobokEventArgs.Directions == Direction.RIGHT)
     {
         CurrentPosition.X += (20 * Speed);
     }
     else if (kolobokEventArgs.Directions == Direction.LEFT)
     {
         CurrentPosition.X -= (20 * Speed);
     }
     else if (kolobokEventArgs.Directions == Direction.UP)
     {
         CurrentPosition.Y -= (20 * Speed);
     }
     else if (kolobokEventArgs.Directions == Direction.DOWN)
     {
         CurrentPosition.Y += (20 * Speed);
     }
     if (kolobok != null)
     {
         kolobok.ShotEvent -= Kolobok_ShotEvent;
     }
     if (tank != null)
     {
         tank.ShotEvent -= Kolobok_ShotEvent;
     }
 }
Example #2
0
        internal void Shot()
        {
            KolobokEventArgs kolobokEventArgs = new KolobokEventArgs(CurrentPosition, Directions);

            Shot shot = new Shot(imageList, this);

            positionsOfShot.Add(shot);
            OnShot(kolobokEventArgs);
        }
Example #3
0
 private void Kolobok_ShotEvent(object sender, EventArgs e)
 {
     if (e is KolobokEventArgs)
     {
         KolobokEventArgs kolobokEventArgs = e as KolobokEventArgs;
         Directions = kolobokEventArgs.Directions;
         Move(kolobokEventArgs);
     }
 }
Example #4
0
        public void OnShot(KolobokEventArgs e)
        {
            EventHandler shotEvent = ShotEvent;

            shotEvent?.Invoke(this, e);
        }