/// <summary> /// Raise a PlayActionSoundEvent /// </summary> /// <param name="i_Action">The action that cause the event</param> private void onPlayActionSoundEvent(eSoundActions i_Action) { if (PlayActionSoundEvent != null) { PlayActionSoundEvent(i_Action); } }
/// <summary> /// Catch the PlayActionSoundEvent raised by a SoundableGameComponent /// and plays the action sound /// </summary> /// <param name="i_Action">The action that happened in the game that /// should result in playing a sound</param> protected void Component_PlayActionSoundEvent(eSoundActions i_Action) { PlayActionCue(i_Action); }
/// <summary> /// Plays a cue for a given action in the game /// </summary> /// <param name="i_Action">The action that we need to play a cue for</param> protected void PlayActionCue(eSoundActions i_Action) { string cue = SoundFactory.GetActionCue(i_Action); if (!cue.Equals(String.Empty)) { m_SoundManager.Play(cue, false); } }
/// <summary> /// Gets a game action cue name /// </summary> /// <param name="i_Action">The action we want to get a cue for</param> /// <returns>The name of the cue that matches the given action or String.Empty /// if no such cue exists</returns> public static string GetActionCue(eSoundActions i_Action) { string retVal = String.Empty; s_ActionCues.TryGetValue(i_Action, out retVal); return retVal; }