Bare minimum tangible manager functionality OK
This commit is contained in:
@@ -194,7 +194,7 @@ void AIntegrationGameModeBase::BeginPlay()
|
|||||||
|
|
||||||
// Create a tangible.
|
// Create a tangible.
|
||||||
TangibleManager.Init(GetWorld(), ClassTangibleActor);
|
TangibleManager.Init(GetWorld(), ClassTangibleActor);
|
||||||
//TangibleManager.MakeTangible(123);
|
TangibleManager.MakeTangible(123);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AIntegrationGameModeBase::EndPlay(const EEndPlayReason::Type EndPlayReason)
|
void AIntegrationGameModeBase::EndPlay(const EEndPlayReason::Type EndPlayReason)
|
||||||
|
|||||||
@@ -3,37 +3,37 @@
|
|||||||
|
|
||||||
#include "TangibleManager.h"
|
#include "TangibleManager.h"
|
||||||
|
|
||||||
//using AActorPtr = AActor*;
|
using AActorPtr = AActor*;
|
||||||
|
|
||||||
void FTangibleManager::Init(UWorld *world, UClass* tanact) {
|
void FTangibleManager::Init(UWorld *world, UClass* tanact) {
|
||||||
World = world;
|
World = world;
|
||||||
ClassTangibleActor = tanact;
|
ClassTangibleActor = tanact;
|
||||||
}
|
}
|
||||||
|
|
||||||
//AActorPtr FTangibleManager::GetTangible(int64 id) {
|
AActorPtr FTangibleManager::GetTangible(int64 id) {
|
||||||
// AActorPtr *p = IdToActor.Find(id);
|
AActorPtr *p = IdToActor.Find(id);
|
||||||
// if (p == nullptr) {
|
if (p == nullptr) {
|
||||||
// return nullptr;
|
return nullptr;
|
||||||
// } else {
|
} else {
|
||||||
// return *p;
|
return *p;
|
||||||
// }
|
}
|
||||||
//}
|
}
|
||||||
//
|
|
||||||
//// Get the tangible if it exists, otherwise create it.
|
// Get the tangible if it exists, otherwise create it.
|
||||||
//AActorPtr FTangibleManager::MakeTangible(int64 id) {
|
AActorPtr FTangibleManager::MakeTangible(int64 id) {
|
||||||
// AActorPtr& p = IdToActor.FindOrAdd(id);
|
AActorPtr& p = IdToActor.FindOrAdd(id);
|
||||||
// if (p == nullptr) {
|
if (p == nullptr) {
|
||||||
// FVector location;
|
FVector location;
|
||||||
// FRotator rotation;
|
FRotator rotation;
|
||||||
// FActorSpawnParameters params;
|
FActorSpawnParameters params;
|
||||||
// p = w->SpawnActor(ClassTangibleActor, &location, &rotation, params);
|
p = World->SpawnActor(ClassTangibleActor, &location, &rotation, params);
|
||||||
// assert(p != nullptr);
|
check(p != nullptr);
|
||||||
// }
|
}
|
||||||
// return p;
|
return p;
|
||||||
//}
|
}
|
||||||
//
|
|
||||||
//// Delete the tangible.
|
// Delete the tangible.
|
||||||
//void FTangibleManager::DeleteTangible(int64 id) {
|
void FTangibleManager::DeleteTangible(int64 id) {
|
||||||
// // IMPLEMENT ME
|
// IMPLEMENT ME
|
||||||
//}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,21 +22,21 @@ public:
|
|||||||
UPROPERTY()
|
UPROPERTY()
|
||||||
TSubclassOf<AActor> ClassTangibleActor;
|
TSubclassOf<AActor> ClassTangibleActor;
|
||||||
|
|
||||||
//// Given a tangible ID, look up actor pointer (or NULL if actor was deleted)
|
// Given a tangible ID, look up actor pointer (or NULL if actor was deleted)
|
||||||
//UPROPERTY()
|
UPROPERTY()
|
||||||
//TMap<int64, AActor*> IdToActor;
|
TMap<int64, AActor*> IdToActor;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Initialize the tangible manager.
|
// Initialize the tangible manager.
|
||||||
//
|
//
|
||||||
void Init(UWorld *world, UClass* tanact);
|
void Init(UWorld *world, UClass* tanact);
|
||||||
|
|
||||||
//// Get the tangible if it exists, otherwise return NULL
|
// Get the tangible if it exists, otherwise return NULL
|
||||||
//AActor* GetTangible(int64 id);
|
AActor* GetTangible(int64 id);
|
||||||
|
|
||||||
//// Get the tangible if it exists, otherwise create it.
|
// Get the tangible if it exists, otherwise create it.
|
||||||
//AActor* MakeTangible(int64 id);
|
AActor* MakeTangible(int64 id);
|
||||||
|
|
||||||
//// Delete the tangible.
|
// Delete the tangible.
|
||||||
//void DeleteTangible(int64 id);
|
void DeleteTangible(int64 id);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user