示例#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;
     }
 }
示例#2
0
        internal void Shot()
        {
            KolobokEventArgs kolobokEventArgs = new KolobokEventArgs(CurrentPosition, Directions);

            Shot shot = new Shot(imageList, this);

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

            shotEvent?.Invoke(this, e);
        }