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-26 17:00:30 -04:00
|
|
|
#include "Tangible.h"
|
2023-09-15 00:01:41 -04:00
|
|
|
#include "DebugPrint.h"
|
2023-09-02 01:33:11 -04:00
|
|
|
|
2023-09-15 00:01:41 -04:00
|
|
|
using namespace DebugPrint;
|
2023-09-02 01:33:11 -04:00
|
|
|
|
2023-09-26 17:00:30 -04:00
|
|
|
UlxTangibleManager::UlxTangibleManager() {
|
2023-09-06 23:25:37 -04:00
|
|
|
World = nullptr;
|
|
|
|
|
ClassTangibleActor = nullptr;
|
2023-09-25 18:00:34 -04:00
|
|
|
Player = 0;
|
2023-09-07 23:50:49 -04:00
|
|
|
Near = IdView();
|
2023-09-06 23:25:37 -04:00
|
|
|
}
|
|
|
|
|
|
2023-09-26 17:00:30 -04:00
|
|
|
void UlxTangibleManager::Init(UWorld* world, UClass* tanact) {
|
2023-09-02 01:39:35 -04:00
|
|
|
World = world;
|
|
|
|
|
ClassTangibleActor = tanact;
|
2023-09-25 18:00:34 -04:00
|
|
|
Player = 0;
|
2023-09-07 23:50:49 -04:00
|
|
|
Near = IdView();
|
2023-09-02 01:39:35 -04:00
|
|
|
}
|
|
|
|
|
|
2023-09-26 17:00:30 -04:00
|
|
|
UlxTangible* UlxTangibleManager::GetTangible(int64 id) {
|
|
|
|
|
UlxTangible** p = IdToTangible.Find(id);
|
2023-09-02 01:43:44 -04:00
|
|
|
if (p == nullptr) {
|
|
|
|
|
return nullptr;
|
2023-09-26 17:00:30 -04:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
return *p;
|
2023-09-02 01:43:44 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-26 17:00:30 -04:00
|
|
|
UlxTangible* UlxTangibleManager::MakeTangible(int64 id) {
|
|
|
|
|
UlxTangible*& t = IdToTangible.FindOrAdd(id);
|
|
|
|
|
if (t == nullptr) {
|
|
|
|
|
t = NewObject<UlxTangible>();
|
|
|
|
|
t->Init(this, id);
|
|
|
|
|
|
|
|
|
|
// TODO: fix this. The blueprint needs to be assigned
|
|
|
|
|
// during animation queue parsing, based on the animation
|
|
|
|
|
// queue keyword 'bp'.
|
|
|
|
|
t->SetActorBlueprintClass(ClassTangibleActor);
|
2023-09-02 01:43:44 -04:00
|
|
|
}
|
2023-09-26 17:00:30 -04:00
|
|
|
return t;
|
2023-09-02 01:43:44 -04:00
|
|
|
}
|
|
|
|
|
|
2023-09-26 17:00:30 -04:00
|
|
|
void UlxTangibleManager::DeleteTangible(int64 id) {
|
2023-09-02 01:43:44 -04:00
|
|
|
// IMPLEMENT ME
|
|
|
|
|
}
|
2023-09-07 23:50:49 -04:00
|
|
|
|
2023-09-26 17:00:30 -04:00
|
|
|
UlxTangibleManager::IdArray UlxTangibleManager::GetLive() {
|
2023-09-07 23:50:49 -04:00
|
|
|
IdArray result;
|
2023-09-26 17:00:30 -04:00
|
|
|
result.SetNum(IdToTangible.Num());
|
2023-09-07 23:50:49 -04:00
|
|
|
int next = 0;
|
2023-09-26 17:00:30 -04:00
|
|
|
for (auto& pair : IdToTangible) {
|
2023-09-07 23:50:49 -04:00
|
|
|
result[next++] = pair.Key;
|
|
|
|
|
}
|
|
|
|
|
return result;
|
2023-09-25 18:00:34 -04:00
|
|
|
}
|
2023-09-26 17:00:30 -04:00
|
|
|
|