Load TangibleActor by name in TangibleManager

This commit is contained in:
2024-01-22 17:11:21 -05:00
parent 704a2edb36
commit fa045af87f
13 changed files with 26 additions and 25 deletions

View File

@@ -253,7 +253,7 @@ void AIntegrationGameModeBase::BeginPlay()
// Initialize the tangible manager.
TangibleManager = NewObject<UlxTangibleManager>();
TangibleManager->Init(GetWorld(), ClassTangibleActor);
TangibleManager->Init(GetWorld());
}
void AIntegrationGameModeBase::EndPlay(const EEndPlayReason::Type EndPlayReason)

View File

@@ -39,10 +39,6 @@ public:
UFUNCTION(BlueprintCallable, Category = "Luprex")
void ConsoleSendInput(const FString& text);
// The blueprint class TangibleActor
UPROPERTY(EditDefaultsOnly, Category = "Luprex")
TSubclassOf<AActor> ClassTangibleActor;
// Execute a debugging command, typed on the GUI.
void ExecuteDebuggingCommand(const FString &fs);

View File

@@ -11,12 +11,14 @@ using IdArray = UlxTangibleManager::IdArray;
UlxTangibleManager::UlxTangibleManager() {
World = nullptr;
ClassTangibleActor = nullptr;
ClassTangibleActor = LoadObject<UClass>(nullptr, TEXT("/Game/Tangibles/TangibleStaticMesh.TangibleStaticMesh_C"));
static ConstructorHelpers::FClassFinder<AActor> Asset(TEXT("/Game/Tangibles/TangibleStaticMesh"));
// if(Asset.Succeeded())
// ClassTangibleActor = Asset.Class;
}
void UlxTangibleManager::Init(UWorld* world, UClass* tanact) {
void UlxTangibleManager::Init(UWorld* world) {
World = world;
ClassTangibleActor = tanact;
}
UlxTangible* UlxTangibleManager::GetTangible(int64 id) const {

View File

@@ -28,6 +28,9 @@ public:
UPROPERTY()
TSubclassOf<AActor> ClassTangibleActor;
// A pointer to the name-to-actor data table.
UDataTable *NameToActorTable;
// Given a tangible ID, look up the TangibleComponent of that actor.
UPROPERTY()
TMap<int64, UlxTangible*> IdToTangible;
@@ -37,7 +40,7 @@ public:
// Initialize the tangible manager.
//
void Init(UWorld *world, UClass* tanact);
void Init(UWorld *world);
// Get a pointer to our world.
//