protected override void ShootingPattern(GameTime gameTime) { EnemyHomingBullet bullet = new EnemyHomingBullet(Game, spriteSheet, player); bullet.Position = Position; bullet.Direction = MathFunctions.ScaleDirection(ShootObject.Position - Position); bullet.Initialize(); Game.stateManager.shooterState.gameObjects.Add(bullet); }
private void HandleShooting(GameTime gameTime) { lastTimeShot += gameTime.ElapsedGameTime.Milliseconds; if (lastTimeShot >= shootingDelay) { lastTimeShot -= shootingDelay; double width = Math.PI; int numberOfShots = 4; for (double dir = -width / 2 + Math.PI / 2; dir <= width / 2 + Math.PI / 2; dir += (width / numberOfShots)) { EnemyHomingBullet bullet = new EnemyHomingBullet(Game, spriteSheet, player); bullet.Position = Position; bullet.Direction = MathFunctions.DirFromRadians(dir); bullet.Initialize(); Game.stateManager.shooterState.gameObjects.Add(bullet); Game.soundEffectsManager.PlaySoundEffect(SoundEffects.SmallLaser, soundPan); } } }