public void Die(Player player, Fleet fleet, ShipWeaponBullet bullet) { if (player != null) { World.Scoring.ShipDied(player, this.Fleet?.Owner, this); } fleet?.KilledShip(this); base.Die(); if (!(this.GetType() == typeof(Fish)) && !this.Abandoned) { Boom.FromShip(this); } if (this.Fleet != null) { this.Fleet.ShipDeath(player, this, bullet); } }
public override void Think() { if (ShotCooldown < World.Time) { var target = World.BodiesNear(this.Position, 2500) .OfType <Ship>() .Where(s => s.Abandoned == false) .Where(s => s.Sprite != API.Common.Sprites.fish) .FirstOrDefault(); if (target != null) { var bullet = new ShipWeaponBullet(); var toTarget = target.Position - Position; bullet.FireFrom(this, MathF.Atan2(toTarget.Y, toTarget.X)); NewBullets.Add(bullet); ShotCooldown = World.Time + 300; } } }