// Fill out your copyright notice in the Description page of Project Settings. #include "TangibleManager.h" #include "TangibleInterface.h" #include "DebugPrint.h" using namespace DebugPrint; FTangibleManager::FTangibleManager() { World = nullptr; ClassTangibleActor = nullptr; Actor = 0; Near = IdView(); } void FTangibleManager::Init(UWorld *world, UClass* tanact) { World = world; ClassTangibleActor = tanact; Actor = 0; Near = IdView(); } UlxTangible *FTangibleManager::GetTangible(int64 id) { UlxTangible **p = IdToTangible.Find(id); if (p == nullptr) { return nullptr; } else { return *p; } } UlxTangible *FTangibleManager::MakeTangible(int64 id) { UlxTangible *& p = IdToTangible.FindOrAdd(id); if (p == nullptr) { FVector location(0,0,0); FRotator rotation(0, 0, 0); FActorSpawnParameters params; AActor* a = World->SpawnActor(ClassTangibleActor, &location, &rotation, params); check(a != nullptr); check(a->GetClass()->ImplementsInterface(UlxTangibleInterface::StaticClass())); p = NewObject(); p->Init(a); } return p; } void FTangibleManager::DeleteTangible(int64 id) { // IMPLEMENT ME } FTangibleManager::IdArray FTangibleManager::GetLive() { IdArray result; result.SetNum(IdToTangible.Num()); int next = 0; for (auto &pair : IdToTangible) { result[next++] = pair.Key; } return result; }