Example #1
0
 protected override void OnCheckPosition(object sender, RectEventArgs e)
 {
     if (!Rect.Contains(e.NewRect))
     {
         if (sender is Tank)
         {
             TankCollision(sender as Tank);
         }
         else if (sender is Shell)
         {
             ShellCollision(sender as Shell);
         }
     }
 }
Example #2
0
 protected virtual void OnCheckPosition(object sender, RectEventArgs e)
 {
     if (Rect.IntersectsWith(e.NewRect))
     {
         if (sender is Tank)
         {
             TankCollision(sender as Tank);
         }
         else if (sender is Shell)
         {
             ShellCollision(sender as Shell);
         }
     }
 }
Example #3
0
 protected override void OnCheckPosition(object sender, RectEventArgs e)
 {
     if (!ExplosionTimer.Enabled)
     {
         if (sender is Tank && Rect.IntersectsWith(e.NewRect) && !Rect.IntersectsWith(e.CurrentRect))
         {
             TankCollision(sender as Tank);
         }
         else if (sender is Shell && Rect.IntersectsWith(e.NewRect))
         {
             ShellCollision(sender as Shell);
         }
     }
 }
Example #4
0
 protected void InvokeCheckPosition(RectEventArgs e)
 {
     CheckPosition?.Invoke(this, e);
 }