public override void Update(GameTime gameTime) { ParentShip.SetDestination(Target.Position); foreach (var weapon in ParentShip.Weapons) { if (weapon.TargetType != Target.TargetType) { continue; } if (Vector2.Distance(Target.Position, ParentShip.Position) <= weapon.Range && weapon.CurrentCooldown <= 0) { var angle = MathF.Abs(ParentShip.GetAngleToTarget(Target.Position) - ParentShip.Rotation); if (angle <= weapon.MaxAngle) { GameplayState.ProjectileManager.FireProjectile(weapon, ParentShip, Target, weapon.Damage); weapon.ResetCooldown(); } } } }