2023-09-02 01:33:11 -04:00
|
|
|
// Fill out your copyright notice in the Description page of Project Settings.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "TangibleManager.h"
|
|
|
|
|
|
2023-09-02 01:43:44 -04:00
|
|
|
using AActorPtr = AActor*;
|
2023-09-02 01:33:11 -04:00
|
|
|
|
2023-09-02 01:39:35 -04:00
|
|
|
void FTangibleManager::Init(UWorld *world, UClass* tanact) {
|
|
|
|
|
World = world;
|
|
|
|
|
ClassTangibleActor = tanact;
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-02 01:43:44 -04:00
|
|
|
AActorPtr FTangibleManager::GetTangible(int64 id) {
|
|
|
|
|
AActorPtr *p = IdToActor.Find(id);
|
|
|
|
|
if (p == nullptr) {
|
|
|
|
|
return nullptr;
|
|
|
|
|
} else {
|
|
|
|
|
return *p;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Get the tangible if it exists, otherwise create it.
|
|
|
|
|
AActorPtr FTangibleManager::MakeTangible(int64 id) {
|
|
|
|
|
AActorPtr& p = IdToActor.FindOrAdd(id);
|
|
|
|
|
if (p == nullptr) {
|
|
|
|
|
FVector location;
|
|
|
|
|
FRotator rotation;
|
|
|
|
|
FActorSpawnParameters params;
|
|
|
|
|
p = World->SpawnActor(ClassTangibleActor, &location, &rotation, params);
|
|
|
|
|
check(p != nullptr);
|
|
|
|
|
}
|
|
|
|
|
return p;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Delete the tangible.
|
|
|
|
|
void FTangibleManager::DeleteTangible(int64 id) {
|
|
|
|
|
// IMPLEMENT ME
|
|
|
|
|
}
|
2023-09-02 01:33:11 -04:00
|
|
|
|