void USoundEffectManager::PlaySoundEffect(ESoundEffects SFX_To_Play) { UAudioComponent* Audio = NewObject<UAudioComponent>(this); Audio->RegisterComponent(); Audio->OnAudioFinished.Add(AudioFinishDelegate); USoundWave* SoundEffect = EnumToSoundEffect(SFX_To_Play); Audio->Sound = SoundEffect; Audio->Play(); SoundEffectComponents.Add(Audio); }
void USoundEffectManager::PlaySoundEffect_3D(ESoundEffects SFX_To_Play) { UAudioComponent* Audio = NewObject<UAudioComponent>(this); Audio->RegisterComponent(); Audio->AttachTo(GetOwner()->GetRootComponent(),"",EAttachLocation::SnapToTarget,true); Audio->OnAudioFinished.Add(AudioFinishDelegate); USoundWave* SoundEffect = EnumToSoundEffect(SFX_To_Play); Audio->bAllowSpatialization = true; Audio->bOverrideAttenuation = true; Audio->AttenuationOverrides.OmniRadius = 100.f; Audio->AttenuationOverrides.FalloffDistance = 3000.f; Audio->Sound = SoundEffect; Audio->Play(); SoundEffectComponents.Add(Audio); }