public override void Dispose() { PlayerOwner.WeaponFired -= WeaponFiredHandler; if (_runningSound != null) { _runningSound.Dispose(); _runningSound = null; } base.Dispose(); }
/// <summary> /// Activates a menu component after deactivating the previously active menu component /// and moving the menu view to the new component. /// </summary> /// <param name="component">The menu component to activate and move menu view to.</param> public void Activate(MenuComponentType component) { if (component == _activeComponentType && ActiveComponent.Active) return; ActiveComponent.Active = false; _activeComponentType = component; var newComponent = ActiveComponent; // Make menu view scroll to the new component's position. _viewTarget = newComponent.Center; float duration = RandomHelper.GetRandomFloat(0.9f, 1.1f); _viewCurve.SetTarget(_viewTarget, Game.GameTime.TotalRealTime, duration, MovementCurve.Curvature.FastSlow); if (_menuChangeSound != null) { _menuChangeSound.Stop(); _menuChangeSound.Dispose(); } _menuChangeSound = Game.SoundEngine.PlaySound("MenuChangeStart"); // The new component will be activated in 'Update()' when the view is closer to its center. _activeComponentSoundPlayedOnce = _activeComponentActivatedOnce = false; }
public override void Activate() { base.Activate(); _runningSound = Owner.Game.SoundEngine.CreateSound(_runningSoundName, Owner); }
public override void Dispose() { if (_chargingSound != null) _chargingSound.Dispose(); _chargingSound = null; if (_dockSound != null) _dockSound.Dispose(); _dockSound = null; base.Dispose(); }
public override void Activate() { base.Activate(); CreateDockEffects(); _chargingSound = Game.SoundEngine.CreateSound("HomeBaseLoop", this); _dockSound = Game.SoundEngine.CreateSound("HomeBaseLoopLow", this); _dockArea = CollisionAreas.First(area => area.Name == "Dock"); }
/// <summary> /// Attaches the thruster to a gob. Call this method right after creating the gob. /// </summary> public void Activate(Gob owner) { if (owner == null) throw new ArgumentNullException("owner"); Owner = owner; _exhaustEngines = CreateExhaustEngines(); if (HasSound) { _thrusterSound = Owner.Game.SoundEngine.CreateSound(_runningSound, Owner); _thrusterTurnSound = Owner.Game.SoundEngine.CreateSound("LowEngine", Owner); } }
public void Dispose() { if (HasSound) { _thrusterSound.Dispose(); _thrusterSound = null; _thrusterTurnSound.Dispose(); _thrusterTurnSound = null; } }