public override void Fire() { currentFireTimer = 0; // We don't care what our bullets are called as we will never refer to them by name nameCounter++; BulletManager.AddObject(Bullet.Clone(), "Bullet" + nameCounter); if (FiringSoundEffect != null) { firingSoundEffectInstance = FiringSoundEffect.CreateInstance(); firingSoundEffectInstance.Volume = Options.SFXVolume; firingSoundEffectInstance.Play(); } }
public override void Fire() { currentFireTimer = 0; // We don't care what our bullets are called as we will never refer to them by name nameCounter++; Missile clone = Missile.Clone(); clone.RigidBody.LinearVelocity = new Vector2(-250, clone.RigidBody.LinearVelocity.Y); MissileManager.AddObject(clone, "Missile" + nameCounter); if (FiringSoundEffect != null) { firingSoundEffectInstance = FiringSoundEffect.CreateInstance(); firingSoundEffectInstance.Volume = Options.SFXVolume; firingSoundEffectInstance.Play(); } }
public override void Initialize() { base.Initialize(); Beam = new Beam(this, ShipBeamTurretData.BulletAsset, true); Beam.LoadContent(); Beam.Initialize(); Beam.Opacity = 0; // Create the firing sound effect instance - we will just pause and unpause this // Bit of a hack, we play, but with 0 volume so that we can just pause and resume later, rather than having to check in Fire() whether it has been played yet firingSoundEffectInstance = FiringSoundEffect.CreateInstance(); firingSoundEffectInstance.IsLooped = true; firingSoundEffectInstance.Volume = 0; firingSoundEffectInstance.Play(); firing = false; }