// Fill out your copyright notice in the Description page of Project Settings. #include "TangibleManager.h" #include "TangibleInterface.h" #include "DebugPrint.h" using namespace DebugPrint; UTangibleManager::UTangibleManager() { World = nullptr; ClassTangibleActor = nullptr; Actor = 0; Near = IdView(); } void UTangibleManager::Init(UWorld *world, UClass* tanact) { World = world; ClassTangibleActor = tanact; Actor = 0; Near = IdView(); } UlxTangible *UTangibleManager::GetTangible(int64 id) { UlxTangible **p = IdToTangible.Find(id); if (p == nullptr) { return nullptr; } else { return *p; } } UlxTangible *UTangibleManager::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, TEXT("")); } return p; } void UTangibleManager::DeleteTangible(int64 id) { // IMPLEMENT ME } UTangibleManager::IdArray UTangibleManager::GetLive() { IdArray result; result.SetNum(IdToTangible.Num()); int next = 0; for (auto &pair : IdToTangible) { result[next++] = pair.Key; } return result; }