Make TangibleManager a UObject
This commit is contained in:
BIN
Content/TangibleActor.uasset
LFS
BIN
Content/TangibleActor.uasset
LFS
Binary file not shown.
@@ -42,7 +42,7 @@ static bool SetProperty(const FString& name, UObject* obj, const FlxAnimationFie
|
||||
FDoubleProperty* fprop = FindFProperty<FDoubleProperty>(uclass, nname);
|
||||
if (fprop == nullptr) return false;
|
||||
double* pptr = fprop->ContainerPtrToValuePtr<double>(obj);
|
||||
fprop->SetPropertyValue(pptr, field.X);
|
||||
*pptr = field.X;
|
||||
return true;
|
||||
}
|
||||
case ElxAnimValueType::BOOLEAN: {
|
||||
|
||||
@@ -129,18 +129,13 @@ public:
|
||||
|
||||
UFUNCTION(BlueprintCallable, BlueprintPure, Category = Luprex)
|
||||
static bool AnimationStepGetBool(const FlxAnimationStep& step, const FString& name);
|
||||
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////
|
||||
//
|
||||
// Exposing functions to blueprints.
|
||||
//
|
||||
////////////////////////////////////////////////
|
||||
|
||||
//UFUNCTION(BlueprintCallable)
|
||||
//void Unpack(const FString& prefix, UObject* into, bool preclear = true);
|
||||
|
||||
struct FlxAnimationStepView {
|
||||
uint64 Hash;
|
||||
std::string_view Body;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -57,7 +57,7 @@ public:
|
||||
virtual uint32 Run() override;
|
||||
|
||||
UPROPERTY()
|
||||
FTangibleManager TangibleManager;
|
||||
UTangibleManager *TangibleManager;
|
||||
|
||||
// This stores the entire text currently visible in the console.
|
||||
FlxConsoleOutput ConsoleOutput;
|
||||
|
||||
@@ -22,8 +22,10 @@ public:
|
||||
|
||||
FlxAnimTracker AnimTracker;
|
||||
|
||||
void Init(AActor* a) {
|
||||
FString Plane;
|
||||
|
||||
void Init(AActor* a, const FString &plane) {
|
||||
Actor = a;
|
||||
Plane = plane;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -7,21 +7,21 @@
|
||||
|
||||
using namespace DebugPrint;
|
||||
|
||||
FTangibleManager::FTangibleManager() {
|
||||
UTangibleManager::UTangibleManager() {
|
||||
World = nullptr;
|
||||
ClassTangibleActor = nullptr;
|
||||
Actor = 0;
|
||||
Near = IdView();
|
||||
}
|
||||
|
||||
void FTangibleManager::Init(UWorld *world, UClass* tanact) {
|
||||
void UTangibleManager::Init(UWorld *world, UClass* tanact) {
|
||||
World = world;
|
||||
ClassTangibleActor = tanact;
|
||||
Actor = 0;
|
||||
Near = IdView();
|
||||
}
|
||||
|
||||
UlxTangible *FTangibleManager::GetTangible(int64 id) {
|
||||
UlxTangible *UTangibleManager::GetTangible(int64 id) {
|
||||
UlxTangible **p = IdToTangible.Find(id);
|
||||
if (p == nullptr) {
|
||||
return nullptr;
|
||||
@@ -30,7 +30,7 @@ UlxTangible *FTangibleManager::GetTangible(int64 id) {
|
||||
}
|
||||
}
|
||||
|
||||
UlxTangible *FTangibleManager::MakeTangible(int64 id) {
|
||||
UlxTangible *UTangibleManager::MakeTangible(int64 id) {
|
||||
UlxTangible *& p = IdToTangible.FindOrAdd(id);
|
||||
if (p == nullptr) {
|
||||
FVector location(0,0,0);
|
||||
@@ -40,16 +40,16 @@ UlxTangible *FTangibleManager::MakeTangible(int64 id) {
|
||||
check(a != nullptr);
|
||||
check(a->GetClass()->ImplementsInterface(UlxTangibleInterface::StaticClass()));
|
||||
p = NewObject<UlxTangible>();
|
||||
p->Init(a);
|
||||
p->Init(a, TEXT(""));
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
void FTangibleManager::DeleteTangible(int64 id) {
|
||||
void UTangibleManager::DeleteTangible(int64 id) {
|
||||
// IMPLEMENT ME
|
||||
}
|
||||
|
||||
FTangibleManager::IdArray FTangibleManager::GetLive() {
|
||||
UTangibleManager::IdArray UTangibleManager::GetLive() {
|
||||
IdArray result;
|
||||
result.SetNum(IdToTangible.Num());
|
||||
int next = 0;
|
||||
|
||||
@@ -8,10 +8,11 @@
|
||||
#include "Tangible.h"
|
||||
#include "TangibleManager.generated.h"
|
||||
|
||||
USTRUCT()
|
||||
struct INTEGRATION_API FTangibleManager
|
||||
UCLASS()
|
||||
class INTEGRATION_API UTangibleManager : public UObject
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
// Import these types into our Namespace.
|
||||
using IdArray = CommonTypes::IdArray;
|
||||
@@ -35,7 +36,7 @@ public:
|
||||
IdView Near;
|
||||
|
||||
public:
|
||||
FTangibleManager();
|
||||
UTangibleManager();
|
||||
|
||||
// Initialize the tangible manager.
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user