void UAkGameplayStatics::PostEvent(class UAkAudioEvent* in_pAkEvent, class AActor* in_pActor, bool in_stopWhenAttachedToDestroyed, FString EventName) { if (in_pAkEvent == NULL && EventName.IsEmpty()) { UE_LOG(LogScript, Warning, TEXT("UAkGameplayStatics::PostEvent: No Event specified!")); return; } if ( in_pActor == NULL ) { UE_LOG(LogScript, Warning, TEXT("UAkGameplayStatics::PostEvent: NULL Actor specified!")); return; } FAkAudioDevice * AkAudioDevice = FAkAudioDevice::Get(); UWorld* CurrentWorld = in_pActor->GetWorld(); if( CurrentWorld->AllowAudioPlayback() && AkAudioDevice ) { if (in_pAkEvent != NULL) { AkAudioDevice->PostEvent(in_pAkEvent, in_pActor, 0, NULL, NULL, in_stopWhenAttachedToDestroyed); } else { AkAudioDevice->PostEvent(EventName, in_pActor, 0, NULL, NULL, in_stopWhenAttachedToDestroyed); } } }
void UAkGameplayStatics::PostEventAtLocationByName( const FString& EventName, FVector Location, FRotator Orientation, UObject* WorldContextObject ) { FAkAudioDevice * AkAudioDevice = FAkAudioDevice::Get(); UWorld* CurrentWorld = GEngine->GetWorldFromContextObject(WorldContextObject); if( CurrentWorld->AllowAudioPlayback() && AkAudioDevice ) { AkAudioDevice->PostEventAtLocation(EventName, Location, Orientation.Vector(), GEngine->GetWorldFromContextObject(WorldContextObject) ); } }
UAkComponent* UAkGameplayStatics::SpawnAkComponentAtLocation(UObject* WorldContextObject, class UAkAudioEvent* AkEvent, FVector Location, FRotator Orientation, bool AutoPost, const FString& EventName, bool AutoDestroy /* = true*/ ) { FAkAudioDevice * AkAudioDevice = FAkAudioDevice::Get(); UWorld* CurrentWorld = GEngine->GetWorldFromContextObject(WorldContextObject); if( CurrentWorld && CurrentWorld->AllowAudioPlayback() && AkAudioDevice ) { return AkAudioDevice->SpawnAkComponentAtLocation(AkEvent, Location, Orientation, AutoPost, EventName, AutoDestroy, CurrentWorld ); } return nullptr; }
void UAkGameplayStatics::PostEventByName(const FString& EventName, class AActor* in_pActor, bool in_stopWhenAttachedToDestroyed) { if ( in_pActor == NULL ) { UE_LOG(LogScript, Warning, TEXT("UAkGameplayStatics::PostEventByName: NULL Actor specified!")); return; } FAkAudioDevice * AkAudioDevice = FAkAudioDevice::Get(); UWorld* CurrentWorld = in_pActor->GetWorld(); if( CurrentWorld->AllowAudioPlayback() && AkAudioDevice ) { AkAudioDevice->PostEvent(EventName, in_pActor, 0, NULL, NULL, in_stopWhenAttachedToDestroyed); } }
void UAkGameplayStatics::PostEventAtLocation( class UAkAudioEvent* in_pAkEvent, FVector Location, FRotator Orientation, const FString& EventName, UObject* WorldContextObject ) { if ( in_pAkEvent == NULL && EventName.IsEmpty() ) { UE_LOG(LogScript, Warning, TEXT("UAkGameplayStatics::PostEventAtLocation: No Event specified!")); return; } FAkAudioDevice * AkAudioDevice = FAkAudioDevice::Get(); UWorld* CurrentWorld = GEngine->GetWorldFromContextObject(WorldContextObject); if( CurrentWorld->AllowAudioPlayback() && AkAudioDevice ) { if (in_pAkEvent != NULL) { AkAudioDevice->PostEventAtLocation(in_pAkEvent, Location, Orientation.Vector(), GEngine->GetWorldFromContextObject(WorldContextObject)); } else { AkAudioDevice->PostEventAtLocation(EventName, Location, Orientation.Vector(), GEngine->GetWorldFromContextObject(WorldContextObject)); } } }