TangibleCharacter can now be interactively controlled

This commit is contained in:
2024-02-02 15:48:27 -05:00
parent 4b3315eb76
commit d11fbca815
18 changed files with 96 additions and 28 deletions

View File

@@ -17,6 +17,7 @@ using namespace CommonTypes;
AIntegrationGameModeBase::AIntegrationGameModeBase()
{
TangibleManager = NewObject<UlxTangibleManager>();
PlayerId = 0;
EngineSeconds = 0.0;
NextThreadTrigger = 1.0;
//PrimaryActorTick.bCanEverTick = true; // Probably wrong
@@ -113,14 +114,13 @@ void AIntegrationGameModeBase::MaybeTriggerUpdateTask(float deltaseconds) {
#pragma optimize("", off)
void AIntegrationGameModeBase::UpdateTangibles() {
double radius = 1000.0; // Hardwired for now.
using TanArray = UlxTangibleManager::TanArray;
if (!Playing) return;
FlxLockedWrapper w(LockableWrapper);
int64 player = w.GetActor();
IdView nearids = w.GetNear(player, radius, radius, radius);
PlayerId = w.GetActor();
IdView nearids = w.GetNear(PlayerId, radius, radius, radius);
TangibleManager->UpdateNearAccordingToLuprex(nearids);
TanArray alltans = TangibleManager->GetAllTangibles();
IdArray allids = TangibleManager->GetIds(alltans);
@@ -128,7 +128,7 @@ void AIntegrationGameModeBase::UpdateTangibles() {
for (int i = 0; i < alltans.Num(); i++) {
alltans[i]->UpdateAnimationQueue(allqueues[i]);
}
TangibleManager->RecalcNearAccordingToUnreal(player, radius);
TangibleManager->RecalcNearAccordingToUnreal(PlayerId, radius);
TangibleManager->DeleteFarawayTangibles();
}
@@ -155,6 +155,10 @@ void AIntegrationGameModeBase::ExecuteDebuggingCommand(const FString &fs) {
void AIntegrationGameModeBase::ConsoleSendInput(const FString& fs)
{
if (fs.IsEmpty()) {
return;
}
FlxLockedWrapper w(LockableWrapper);
if (w->engine != nullptr)
{
@@ -253,7 +257,7 @@ void AIntegrationGameModeBase::BeginPlay()
// Initialize the tangible manager.
TangibleManager = NewObject<UlxTangibleManager>();
TangibleManager->Init(GetWorld());
TangibleManager->Init(GetWorld(), this);
}
void AIntegrationGameModeBase::EndPlay(const EEndPlayReason::Type EndPlayReason)
@@ -261,3 +265,6 @@ void AIntegrationGameModeBase::EndPlay(const EEndPlayReason::Type EndPlayReason)
ResetToInitialState();
}
int64 AIntegrationGameModeBase::GetPlayerId() {
return PlayerId;
}