Merge branch 'Music-System' into dev
This commit is contained in:
		
						commit
						50605f7d8e
					
				
							
								
								
									
										
											BIN
										
									
								
								EndlessVendetta/Content/Audio/Music/Combat_track_1/Drums.uasset
									 (Stored with Git LFS)
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								EndlessVendetta/Content/Audio/Music/Combat_track_1/Drums.uasset
									 (Stored with Git LFS)
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								EndlessVendetta/Content/Audio/Music/Combat_track_1/Hats_and_clap.uasset
									 (Stored with Git LFS)
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								EndlessVendetta/Content/Audio/Music/Combat_track_1/Hats_and_clap.uasset
									 (Stored with Git LFS)
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								EndlessVendetta/Content/Audio/Music/Combat_track_1/combat_Continuous.uasset
									 (Stored with Git LFS)
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								EndlessVendetta/Content/Audio/Music/Combat_track_1/combat_Continuous.uasset
									 (Stored with Git LFS)
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| @ -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(); | ||||
| 	} | ||||
| } | ||||
| @ -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<USoundBase*> 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<UAudioComponent*> AllAudioComponents; | ||||
| 	TArray<UAudioComponent*> StealthTracksAudioComponents; | ||||
| 	UAudioComponent* InvestigatedTrackAudioComponent; | ||||
| 	UAudioComponent* CombatStartTrackAudioComponent; | ||||
| 	UAudioComponent* CombatContinuousTrackAudioComponent; | ||||
| 	 | ||||
| 	void StartStealthTrack(); | ||||
| 	void StartCombatTrack(); | ||||
| 	void StartInvestigatedTrack(); | ||||
| 	void StopTracks(); | ||||
| }; | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user