Make TangibleManager a UObject

This commit is contained in:
2023-09-25 14:25:24 -04:00
parent 982b6cab62
commit 2f5baf2e9f
8 changed files with 33 additions and 28 deletions

View File

@@ -16,6 +16,7 @@ using namespace CommonTypes;
AIntegrationGameModeBase::AIntegrationGameModeBase()
{
TangibleManager = NewObject<UTangibleManager>();
EngineSeconds = 0.0;
NextThreadTrigger = 1.0;
//PrimaryActorTick.bCanEverTick = true; // Probably wrong
@@ -47,6 +48,11 @@ void AIntegrationGameModeBase::ResetToInitialState()
{
Playing = false;
if (TangibleManager != nullptr) {
TangibleManager->ConditionalBeginDestroy();
TangibleManager = nullptr;
}
// Shut down the thread
LuprexUpdateTask.Shutdown();
@@ -117,18 +123,18 @@ void AIntegrationGameModeBase::UpdateTangibles() {
if (!Playing) return;
FlxLockedWrapper w(LockableWrapper);
int64 actor = w.GetActor();
TangibleManager.SetActor(actor);
TangibleManager.SetNear(w.GetNear(actor, 100, 100, 100));
for (int64 id : TangibleManager.GetNear()) {
TangibleManager.MakeTangible(id);
TangibleManager->SetActor(actor);
TangibleManager->SetNear(w.GetNear(actor, 100, 100, 100));
for (int64 id : TangibleManager->GetNear()) {
TangibleManager->MakeTangible(id);
}
// Update animation queues of live tangibles.
IdArray tanids = TangibleManager.GetLive();
IdArray tanids = TangibleManager->GetLive();
StringViewVec aqueues = w.GetAnimationQueues(tanids);
for (int i = 0; i < tanids.Num(); i++) {
uint64_t tanid = tanids[i];
std::string_view aqueue = aqueues[i];
UlxTangible* t = TangibleManager.GetTangible(tanid);
UlxTangible* t = TangibleManager->GetTangible(tanid);
check(t != nullptr);
t->AnimTracker.Update(aqueue);
@@ -237,7 +243,8 @@ void AIntegrationGameModeBase::BeginPlay()
}
// Initialize the tangible manager.
TangibleManager.Init(GetWorld(), ClassTangibleActor);
TangibleManager = NewObject<UTangibleManager>();
TangibleManager->Init(GetWorld(), ClassTangibleActor);
}
void AIntegrationGameModeBase::EndPlay(const EEndPlayReason::Type EndPlayReason)