Initial work on spawning tangibles from Luprex
This commit is contained in:
@@ -19,6 +19,7 @@ AIntegrationGameModeBase::AIntegrationGameModeBase()
|
||||
SetActorTickEnabled(true);
|
||||
SetActorTickInterval(0.0f);
|
||||
DebugPrintControl::EnableCollection();
|
||||
ResetToInitialState();
|
||||
}
|
||||
|
||||
AIntegrationGameModeBase::~AIntegrationGameModeBase()
|
||||
@@ -39,6 +40,8 @@ uint32 AIntegrationGameModeBase::Run() {
|
||||
|
||||
void AIntegrationGameModeBase::ResetToInitialState()
|
||||
{
|
||||
Playing = false;
|
||||
|
||||
// Shut down the thread
|
||||
LuprexUpdateTask.Shutdown();
|
||||
|
||||
@@ -68,7 +71,9 @@ void AIntegrationGameModeBase::ResetToInitialState()
|
||||
void AIntegrationGameModeBase::UpdateConsoleOutput() {
|
||||
// Copy Luprex Stdout into the console.
|
||||
FLockedWrapper lockedwrap(LockableWrapper);
|
||||
ConsoleOutput.Append(lockedwrap.FetchStdout());
|
||||
if (Playing) {
|
||||
ConsoleOutput.Append(lockedwrap.FetchStdout());
|
||||
}
|
||||
|
||||
// Copy Debugging Prints into the console.
|
||||
TArray<FString> prints = DebugPrintControl::GetStored();
|
||||
@@ -84,6 +89,7 @@ void AIntegrationGameModeBase::UpdateConsoleOutput() {
|
||||
}
|
||||
|
||||
void AIntegrationGameModeBase::MaybeTriggerUpdateTask(float deltaseconds) {
|
||||
if (!Playing) return;
|
||||
FLockedWrapper lockedwrap(LockableWrapper);
|
||||
if (lockedwrap->engine != nullptr)
|
||||
{
|
||||
@@ -96,11 +102,15 @@ void AIntegrationGameModeBase::MaybeTriggerUpdateTask(float deltaseconds) {
|
||||
}
|
||||
}
|
||||
|
||||
void AIntegrationGameModeBase::Tick(float deltaseconds)
|
||||
{
|
||||
Super::Tick(deltaseconds);
|
||||
UpdateConsoleOutput();
|
||||
MaybeTriggerUpdateTask(deltaseconds);
|
||||
void AIntegrationGameModeBase::UpdateTangibles() {
|
||||
if (!Playing) return;
|
||||
FLockedWrapper w(LockableWrapper);
|
||||
int64 actor = w.GetActor();
|
||||
TangibleManager.SetActor(actor);
|
||||
TangibleManager.SetNear(w.GetNear(actor, 100, 100, 100));
|
||||
for (int64 id : TangibleManager.GetNear()) {
|
||||
TangibleManager.MakeTangible(id);
|
||||
}
|
||||
}
|
||||
|
||||
void AIntegrationGameModeBase::ConsoleSendInput(const FString& fs)
|
||||
@@ -120,6 +130,15 @@ void AIntegrationGameModeBase::ConsoleSendInput(const FString& fs)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void AIntegrationGameModeBase::Tick(float deltaseconds)
|
||||
{
|
||||
Super::Tick(deltaseconds);
|
||||
UpdateConsoleOutput();
|
||||
UpdateTangibles();
|
||||
MaybeTriggerUpdateTask(deltaseconds);
|
||||
}
|
||||
|
||||
void AIntegrationGameModeBase::BeginPlay()
|
||||
{
|
||||
Super::BeginPlay();
|
||||
@@ -164,24 +183,22 @@ void AIntegrationGameModeBase::BeginPlay()
|
||||
{
|
||||
DPrint(w->error);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (w->engine != nullptr) {
|
||||
DPrint("Luprex initialize success");
|
||||
Playing = true;
|
||||
}
|
||||
}
|
||||
|
||||
// If we successfully created a luprex engine, create a socket system and a worker thread.
|
||||
if (w->engine != nullptr)
|
||||
{
|
||||
if (Playing) {
|
||||
Sockets.Reset(FLpxSockets::Create(w));
|
||||
std::string error = Sockets->GetError();
|
||||
check(error.empty());
|
||||
LuprexUpdateTask.Startup(this);
|
||||
}
|
||||
|
||||
// Create a tangible.
|
||||
// Initialize the tangible manager.
|
||||
TangibleManager.Init(GetWorld(), ClassTangibleActor);
|
||||
TangibleManager.MakeTangible(123);
|
||||
}
|
||||
|
||||
void AIntegrationGameModeBase::EndPlay(const EEndPlayReason::Type EndPlayReason)
|
||||
|
||||
Reference in New Issue
Block a user