4 [
Attribute(
desc:
"Sound effect played when action is exectuted")]
5 protected string m_sActionSoundEffectEventName;
7 [
Attribute(
desc:
"File that contains the sound effect. Only used as backup if SFX was not played by the SoundComponent on the entity",
params:
"acp")]
8 protected ResourceName m_sActionSoundEffectFile;
13 PlayActionSoundEffect(pOwnerEntity);
26 SoundComponent soundComponent = SoundComponent.Cast(pOwnerEntity.FindComponent(SoundComponent));
32 if (soundComponent.GetEventIndex(m_sActionSoundEffectEventName) > 0)
34 soundComponent.SoundEventOffset(m_sActionSoundEffectEventName, GetLocalPositionAction());
39 Print(
string.Format(
"'SCR_BaseAudioScriptedUserAction': Trying to play sound for '%1' but sound either sound event '%2' or more likely sound file needed is not included on the SoundComponent! SCR_SoundManagerEntity is used instead (if any in the world) but that means position of sound is not updated if entity moves while sound is playing.", pOwnerEntity, m_sActionSoundEffectEventName, m_sActionSoundEffectFile), LogLevel.WARNING);
48 if (!soundManagerEntity)
53 pOwnerEntity.GetTransform(mat);
54 transform[3] = GetWorldPositionAction();
57 SCR_AudioSourceConfiguration audioConfig =
new SCR_AudioSourceConfiguration();
58 audioConfig.m_sSoundProject = m_sActionSoundEffectFile;
59 audioConfig.m_sSoundEventName = m_sActionSoundEffectEventName;
63 soundManagerEntity.CreateAndPlayAudioSource(pOwnerEntity, audioConfig, transform);