public override void Delete(DeleteReasons reason = DeleteReasons.Destroyed) { if (reason == DeleteReasons.SelfDestruction) { Particle.Add(new Particles.Explosion(Position, ExplosionSize) { Color = ExplosionColor }); foreach (var ship in GameControl.Ships) { if (ship != this && Vector2.DistanceSquared(ship.Position, Position) <= ExplosionRangeSquared) { ship.DealDamage(-ExplosionDamage, Vector2.Zero); } } } base.Delete(reason); }
public virtual void Delete(DeleteReasons reason = DeleteReasons.Destroyed) { if (DeleteFlag) { return; } if (reason == DeleteReasons.Destroyed || reason == DeleteReasons.SelfDestruction) { Particle.Add(new Particles.Explosion(Position, (int)this.Sprite.TextureOrigin.Length())); Particle.Add(new Particles.DestroyedShip(Position, Vector2.Zero.Transform(Angle, Speed), Sprite) { Color = Color, Rotation = MathHelper.PiOver2 + Angle }); } DeleteableShips = true; DeleteFlag = true; if (DeleteFlagSet != null) { DeleteFlagSet(this); } }