5 protected ref SCR_AudioSourceConfiguration m_AudioSourceConfiguration;
11 private vector m_vSoundOffset;
13 protected AudioHandle m_AudioHandle = AudioHandle.Invalid;
18 override void OnActionStart(IEntity pUserEntity)
20 if (s_onInstrumentPlayed)
21 s_onInstrumentPlayed.Invoke(
GetGame().GetPlayerManager().GetPlayerIdFromControlledEntity(pUserEntity), m_eInstrumentType);
24 if (!soundManagerEntity)
36 owner.GetTransform(mat);
37 mat[3] = owner.CoordToParent(m_vSoundOffset);
39 AudioSystem.TerminateSound(m_AudioHandle);
40 soundManagerEntity.PlayAudioSource(audioSource, mat);
41 m_AudioHandle = audioSource.m_AudioHandle;
45 override void OnActionCanceled(IEntity pOwnerEntity, IEntity pUserEntity)
47 AudioSystem.TerminateSound(m_AudioHandle);
50 if (!soundManagerEntity)
56 SCR_AudioSourceConfiguration audioSourceConfiguration =
new SCR_AudioSourceConfiguration;
59 audioSourceConfiguration.m_sSoundEventName =
SCR_SoundEvent.SOUND_STOP_PLAYING;
61 SCR_AudioSource audioSource = soundManagerEntity.CreateAudioSource(pOwnerEntity, audioSourceConfiguration);
66 pOwnerEntity.GetTransform(mat);
67 mat[3] = pOwnerEntity.CoordToParent(m_vSoundOffset);
69 soundManagerEntity.PlayAudioSource(audioSource, mat);
70 m_AudioHandle = audioSource.m_AudioHandle;
76 if (!s_onInstrumentPlayed)
79 return s_onInstrumentPlayed;
85 AudioSystem.TerminateSound(m_AudioHandle);