#include "MyActor.h"
AMyActor::AMyActor()
{
PrimaryActorTick.bCanEverTick = false;
Loader = CreateDefaultSubobject<UAtomCueSheetLoaderComponent>("CueSheetLoader");
if (IsValid(Loader)) {
Loader->SetupAttachment(RootComponent);
Loader->CueSheetReference = FSoftObjectPath(FString("/Game/CommonCueSheet.CommonCueSheet"));
}
}
void AMyActor::BeginPlay()
{
Super::BeginPlay();
if (IsValid(Loader)) {
if (Loader->GetStatus() == EAtomCueSheetLoaderComponentStatus::Stop) {
Loader->Load();
}
Loader->OnLoadCompleted.AddDynamic(this, &AMyActor::OnLoadCompleted);
Loader->OnLoadError.AddDynamic(this, &AMyActor::OnLoadFailed);
}
}
void AMyActor::OnLoadCompleted()
{
UE_LOG(LogTemp, Display, TEXT("Loading is completed!"));
}
void AMyActor::OnLoadFailed()
{
UE_LOG(LogTemp, Display, TEXT("Loading is failed!"));
}