diff --git a/Config/DefaultEngine.ini b/Config/DefaultEngine.ini index a264988..9208da0 100644 --- a/Config/DefaultEngine.ini +++ b/Config/DefaultEngine.ini @@ -61,3 +61,6 @@ PhysXTreeRebuildRate=10 DefaultBroadphaseSettings=(bUseMBPOnClient=False,bUseMBPOnServer=False,MBPBounds=(Min=(X=0.000000,Y=0.000000,Z=0.000000),Max=(X=0.000000,Y=0.000000,Z=0.000000),IsValid=0),MBPNumSubdivs=2) + +[CoreRedirects] ++PropertyRedirects=(OldName="/Script/BuildingEscape.RotatingActor.udioComponents",NewName="/Script/BuildingEscape.RotatingActor.Sounds") \ No newline at end of file diff --git a/Content/Audio/Sound/321261__jsbarrett__factory-environment-mix.uasset b/Content/Audio/Sound/321261__jsbarrett__factory-environment-mix.uasset new file mode 100644 index 0000000..7cb296c Binary files /dev/null and b/Content/Audio/Sound/321261__jsbarrett__factory-environment-mix.uasset differ diff --git a/Content/Audio/Sound/452784__aleff-atmos__heavy-gate-metal-03-underground-bunker-of-civil-defense-vsetin-city-club-vesmir.uasset b/Content/Audio/Sound/452784__aleff-atmos__heavy-gate-metal-03-underground-bunker-of-civil-defense-vsetin-city-club-vesmir.uasset new file mode 100644 index 0000000..d59e3e7 Binary files /dev/null and b/Content/Audio/Sound/452784__aleff-atmos__heavy-gate-metal-03-underground-bunker-of-civil-defense-vsetin-city-club-vesmir.uasset differ diff --git a/Content/Audio/Sound/496836__johnzwick45__metallic-groan.uasset b/Content/Audio/Sound/496836__johnzwick45__metallic-groan.uasset new file mode 100644 index 0000000..1b947ad Binary files /dev/null and b/Content/Audio/Sound/496836__johnzwick45__metallic-groan.uasset differ diff --git a/Content/Audio/Sound/509887__smokeymountainboy__door-opend-and-closes2.uasset b/Content/Audio/Sound/509887__smokeymountainboy__door-opend-and-closes2.uasset new file mode 100644 index 0000000..29d0dbb Binary files /dev/null and b/Content/Audio/Sound/509887__smokeymountainboy__door-opend-and-closes2.uasset differ diff --git a/Content/Audio/SoundAttenuation.uasset b/Content/Audio/SoundAttenuation.uasset new file mode 100644 index 0000000..ea5c0ac Binary files /dev/null and b/Content/Audio/SoundAttenuation.uasset differ diff --git a/Content/Levels/FactoryHall.umap b/Content/Levels/FactoryHall.umap index 053cf61..c9c4e7c 100644 Binary files a/Content/Levels/FactoryHall.umap and b/Content/Levels/FactoryHall.umap differ diff --git a/Content/Levels/PersistentLevel.umap b/Content/Levels/PersistentLevel.umap index b134a5d..ae95d92 100644 Binary files a/Content/Levels/PersistentLevel.umap and b/Content/Levels/PersistentLevel.umap differ diff --git a/Content/Levels/PersistentLevel_BuiltData.uasset b/Content/Levels/PersistentLevel_BuiltData.uasset index a6e88f7..ab62ef4 100644 Binary files a/Content/Levels/PersistentLevel_BuiltData.uasset and b/Content/Levels/PersistentLevel_BuiltData.uasset differ diff --git a/Content/Levels/Untitled.umap b/Content/Levels/Untitled.umap index 7b2fba9..cedaf32 100644 Binary files a/Content/Levels/Untitled.umap and b/Content/Levels/Untitled.umap differ diff --git a/Content/Levels/VillaDesign.umap b/Content/Levels/VillaDesign.umap index 58fbff8..ea287a9 100644 Binary files a/Content/Levels/VillaDesign.umap and b/Content/Levels/VillaDesign.umap differ diff --git a/Source/BuildingEscape/RotatingActor.cpp b/Source/BuildingEscape/RotatingActor.cpp index fcb38fd..4beda22 100644 --- a/Source/BuildingEscape/RotatingActor.cpp +++ b/Source/BuildingEscape/RotatingActor.cpp @@ -1,5 +1,7 @@ #include "RotatingActor.h" +#include "Components/AudioComponent.h" + URotatingActor::URotatingActor() { @@ -20,7 +22,8 @@ void URotatingActor::TickComponent(float DeltaTime, ELevelTick TickType, FActorC if (Rotation.Equals(targetRotation, 1.0f)) { rotating = false; - }else + } + else { Rotation.Add(0.0f, DeltaTime * RotationSpeed * tempRotation, 0.0f); GetOwner()->SetActorRotation(Rotation); @@ -33,17 +36,32 @@ void URotatingActor::Rotate(const FRotator TargetRotation) this->targetRotation = TargetRotation; rotating = true; tempRotation = (TargetRotation.Yaw < 0) ? -1.f : 1.f; - if(Negative) + if (Negative) { tempRotation = (TargetRotation.Yaw < 0) ? 1.f : -1.f; } - UAudioComponent * Audio = GetOwner()->FindComponentByClass(); - if(Audio != nullptr && !soundHasBeenPlayed) + TArray Audios; + GetOwner()->GetComponents(Audios); + + if (Audios.Num() == 0) return; + if (soundHasBeenPlayed) return; + + for (auto Audio : Audios) { - Audio->Play(); - soundHasBeenPlayed = true; + if (Audio->ComponentHasTag("location")) + { + UGameplayStatics::PlaySoundAtLocation(GetOwner(), Audio->Sound, GetOwner()->GetActorLocation(), + GetOwner()->GetActorRotation(), 1, 1, 0, + Audio->AttenuationSettings, nullptr, GetOwner()); + } + else + { + Audio->Play(); + } } + + soundHasBeenPlayed = true; } void URotatingActor::Rotate() @@ -51,5 +69,4 @@ void URotatingActor::Rotate() FRotator rotation = GetOwner()->GetActorRotation(); rotation.Yaw = TargetAngle; Rotate(rotation); - -} +} \ No newline at end of file diff --git a/Source/BuildingEscape/RotatingActor.h b/Source/BuildingEscape/RotatingActor.h index b2e5879..9022f0d 100644 --- a/Source/BuildingEscape/RotatingActor.h +++ b/Source/BuildingEscape/RotatingActor.h @@ -3,7 +3,8 @@ #include "CoreMinimal.h" #include "GameFramework/Actor.h" #include "Components/ActorComponent.h" -#include "Components/AudioComponent.h" +#include "Kismet//GameplayStatics.h" + #include "RotatingActor.generated.h"