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); } } }
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); } } }
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); } } }
protected void InvokeCheckPosition(RectEventArgs e) { CheckPosition?.Invoke(this, e); }