Skip to content
Snippets Groups Projects
Commit 782de501 authored by Philipp Schäfer's avatar Philipp Schäfer
Browse files

If a new source component is created, now the signal source is also created accordingly

parent f1f9c8af
No related branches found
No related tags found
No related merge requests found
...@@ -29,6 +29,11 @@ UVASourceComponent::UVASourceComponent() ...@@ -29,6 +29,11 @@ UVASourceComponent::UVASourceComponent()
} }
} }
void UVASourceComponent::OnComponentCreated()
{
ForceUpdateSignalSourceType(SignalSourceType);
}
// Called when the game starts // Called when the game starts
void UVASourceComponent::BeginPlay() void UVASourceComponent::BeginPlay()
{ {
...@@ -183,7 +188,7 @@ void UVASourceComponent::Initialize() ...@@ -183,7 +188,7 @@ void UVASourceComponent::Initialize()
bInitialized = true; bInitialized = true;
} }
bool UVASourceComponent::UpdateSignalSourceType(TSubclassOf<UVAAbstractSignalSource> SignalSourceTypeN) bool UVASourceComponent::ForceUpdateSignalSourceType(TSubclassOf<UVAAbstractSignalSource> SignalSourceTypeN)
{ {
SignalSourceType = nullptr; SignalSourceType = nullptr;
return SetSignalSourceType(SignalSourceTypeN); return SetSignalSourceType(SignalSourceTypeN);
...@@ -671,7 +676,7 @@ void UVASourceComponent::PostEditChangeProperty(FPropertyChangedEvent& PropertyC ...@@ -671,7 +676,7 @@ void UVASourceComponent::PostEditChangeProperty(FPropertyChangedEvent& PropertyC
if (PropertyChangedEvent.GetPropertyName() != GET_MEMBER_NAME_CHECKED(UVASourceComponent, SignalSourceType)) if (PropertyChangedEvent.GetPropertyName() != GET_MEMBER_NAME_CHECKED(UVASourceComponent, SignalSourceType))
return; return;
UpdateSignalSourceType(SignalSourceType); ForceUpdateSignalSourceType(SignalSourceType);
Super::PostEditChangeProperty(PropertyChangedEvent); Super::PostEditChangeProperty(PropertyChangedEvent);
} }
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include "VAEnums.h" // EDir, EPlayAction, EMovement #include "VAEnums.h" // EDir, EPlayAction, EMovement
#include "SignalSources/VAAbstractSignalSource.h" #include "SignalSources/VAAbstractSignalSource.h"
#include "SignalSources/VAAudiofileSignalSource.h"
#include "GameFramework/Actor.h" #include "GameFramework/Actor.h"
#include "SharedPointer.h" #include "SharedPointer.h"
...@@ -39,7 +40,7 @@ protected: ...@@ -39,7 +40,7 @@ protected:
// Select the class of the signal source // Select the class of the signal source
UPROPERTY(EditAnywhere, BlueprintReadOnly, meta = (DisplayName = "Signal Type", Category = "Signal Source", AllowAbstract = "false")) UPROPERTY(EditAnywhere, BlueprintReadOnly, meta = (DisplayName = "Signal Type", Category = "Signal Source", AllowAbstract = "false"))
TSubclassOf<UVAAbstractSignalSource> SignalSourceType = nullptr; TSubclassOf<UVAAbstractSignalSource> SignalSourceType = UVAAudiofileSignalSource::StaticClass();
// Select the type of the signal source // Select the type of the signal source
UPROPERTY(EditAnywhere, Instanced, meta = (DisplayName = "Signal Source", Category = "Signal Source", AllowAbstract = "false")) UPROPERTY(EditAnywhere, Instanced, meta = (DisplayName = "Signal Source", Category = "Signal Source", AllowAbstract = "false"))
...@@ -103,6 +104,8 @@ public: ...@@ -103,6 +104,8 @@ public:
// Sets default values for this component's properties // Sets default values for this component's properties
UVASourceComponent(); UVASourceComponent();
void OnComponentCreated() override;
// Called every frame // Called every frame
void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override; void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
...@@ -252,7 +255,7 @@ protected: ...@@ -252,7 +255,7 @@ protected:
// initialize Sound Source with the settings set // // initialize Sound Source with the settings set //
void Initialize(); void Initialize();
bool UpdateSignalSourceType(TSubclassOf<UVAAbstractSignalSource> SignalSourceTypeN); bool ForceUpdateSignalSourceType(TSubclassOf<UVAAbstractSignalSource> SignalSourceTypeN);
AVAReceiverActor* CurrentReceiverActor; AVAReceiverActor* CurrentReceiverActor;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment