diff --git a/EndlessVendetta/Content/Audio/Music/Combat_track_1/Drums.uasset b/EndlessVendetta/Content/Audio/Music/Combat_track_1/Drums.uasset new file mode 100644 index 00000000..90d587e6 --- /dev/null +++ b/EndlessVendetta/Content/Audio/Music/Combat_track_1/Drums.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d3e771a9dc3e18398e031abc49b4676364e07cdaedf4ff877221ff914bd753fd +size 359591 diff --git a/EndlessVendetta/Content/Audio/Music/Combat_track_1/Hats_and_clap.uasset b/EndlessVendetta/Content/Audio/Music/Combat_track_1/Hats_and_clap.uasset new file mode 100644 index 00000000..84227ac2 --- /dev/null +++ b/EndlessVendetta/Content/Audio/Music/Combat_track_1/Hats_and_clap.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7163166e07477a7969ed6189d668bd5d0cafd3fd29fedb66e2d2fa7ca9ba0c1f +size 141494 diff --git a/EndlessVendetta/Content/Audio/Music/Combat_track_1/combat_Continuous.uasset b/EndlessVendetta/Content/Audio/Music/Combat_track_1/combat_Continuous.uasset new file mode 100644 index 00000000..0853c520 --- /dev/null +++ b/EndlessVendetta/Content/Audio/Music/Combat_track_1/combat_Continuous.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:85501512de2f1d2bd3e0bb2b012e2f73086e9a28245e6f3f538b3d969d4b51cf +size 878633 diff --git a/EndlessVendetta/Source/EndlessVendetta/AI/CombatAudioAutomation.cpp b/EndlessVendetta/Source/EndlessVendetta/AI/CombatAudioAutomation.cpp new file mode 100644 index 00000000..077664eb --- /dev/null +++ b/EndlessVendetta/Source/EndlessVendetta/AI/CombatAudioAutomation.cpp @@ -0,0 +1,75 @@ +// Fill out your copyright notice in the Description page of Project Settings. + + +#include "CombatAudioAutomation.h" + +#include "Components/AudioComponent.h" +#include "Kismet/GameplayStatics.h" + + +// Sets default values for this component's properties +UCombatAudioAutomation::UCombatAudioAutomation() +{ + // Set this component to be initialized when the game starts, and to be ticked every frame. You can turn these features + // off to improve performance if you don't need them. + PrimaryComponentTick.bCanEverTick = true; + + // ... +} + + +// Called when the game starts +void UCombatAudioAutomation::BeginPlay() +{ + Super::BeginPlay(); + + for (USoundBase* Track : StealthTracks) + { + UAudioComponent* AudioComponent = UGameplayStatics::SpawnSound2D(GetWorld(), Track); + AllAudioComponents.Add(AudioComponent); + StealthTracksAudioComponents.Add(AudioComponent); + } + + UAudioComponent* AudioComponent = UGameplayStatics::SpawnSound2D(GetWorld(), InvestigatedTrack); + AllAudioComponents.Add(AudioComponent); + InvestigatedTrackAudioComponent = AudioComponent; + + AudioComponent = UGameplayStatics::SpawnSound2D(GetWorld(), CombatStartTrack); + AllAudioComponents.Add(AudioComponent); + CombatStartTrackAudioComponent = AudioComponent; + + AudioComponent = UGameplayStatics::SpawnSound2D(GetWorld(), CombatContinuousTrack); + AllAudioComponents.Add(AudioComponent); + CombatContinuousTrackAudioComponent = AudioComponent; +} + + +// Called every frame +void UCombatAudioAutomation::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) +{ + Super::TickComponent(DeltaTime, TickType, ThisTickFunction); + + // ... +} + +void UCombatAudioAutomation::StartStealthTrack() +{ + // Play the stealth tracks in order after the previous one has finished + +} + +void UCombatAudioAutomation::StartCombatTrack() +{ +} + +void UCombatAudioAutomation::StartInvestigatedTrack() +{ +} + +void UCombatAudioAutomation::StopTracks() +{ + for (UAudioComponent* AudioComponent : AllAudioComponents) + { + AudioComponent->Stop(); + } +} diff --git a/EndlessVendetta/Source/EndlessVendetta/AI/CombatAudioAutomation.h b/EndlessVendetta/Source/EndlessVendetta/AI/CombatAudioAutomation.h new file mode 100644 index 00000000..3296f05f --- /dev/null +++ b/EndlessVendetta/Source/EndlessVendetta/AI/CombatAudioAutomation.h @@ -0,0 +1,47 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +#pragma once + +#include "CoreMinimal.h" +#include "Components/ActorComponent.h" +#include "CombatAudioAutomation.generated.h" + + +UCLASS(ClassGroup=(Custom), meta=(BlueprintSpawnableComponent)) +class ENDLESSVENDETTA_API UCombatAudioAutomation : public UActorComponent +{ + GENERATED_BODY() + +public: + // Sets default values for this component's properties + UCombatAudioAutomation(); + + UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Audio") + TArray StealthTracks; + UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Audio") + USoundBase* InvestigatedTrack; + UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Audio") + USoundBase* CombatStartTrack; + UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Audio") + USoundBase* CombatContinuousTrack; + +protected: + // Called when the game starts + virtual void BeginPlay() override; + +public: + // Called every frame + virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override; + +private: + TArray AllAudioComponents; + TArray StealthTracksAudioComponents; + UAudioComponent* InvestigatedTrackAudioComponent; + UAudioComponent* CombatStartTrackAudioComponent; + UAudioComponent* CombatContinuousTrackAudioComponent; + + void StartStealthTrack(); + void StartCombatTrack(); + void StartInvestigatedTrack(); + void StopTracks(); +};