2023-09-02 01:33:11 -04:00
|
|
|
// Fill out your copyright notice in the Description page of Project Settings.
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "CoreMinimal.h"
|
|
|
|
|
#include "UObject/NoExportTypes.h"
|
2023-09-07 23:50:49 -04:00
|
|
|
#include "CommonTypes.h"
|
2023-09-26 17:00:30 -04:00
|
|
|
#include "Tangible.h"
|
2023-09-02 01:33:11 -04:00
|
|
|
#include "TangibleManager.generated.h"
|
|
|
|
|
|
2024-02-02 15:48:27 -05:00
|
|
|
class AIntegrationGameModeBase;
|
|
|
|
|
|
2023-09-25 14:25:24 -04:00
|
|
|
UCLASS()
|
2023-09-26 17:00:30 -04:00
|
|
|
class INTEGRATION_API UlxTangibleManager : public UObject
|
2023-09-02 01:33:11 -04:00
|
|
|
{
|
|
|
|
|
GENERATED_BODY()
|
2023-09-25 14:25:24 -04:00
|
|
|
|
2023-09-06 23:25:37 -04:00
|
|
|
public:
|
2023-09-26 19:26:09 -04:00
|
|
|
// Types used frequently.
|
2023-09-08 01:52:30 -04:00
|
|
|
using IdView = CommonTypes::IdView;
|
2023-09-26 19:26:09 -04:00
|
|
|
using IdArray = CommonTypes::IdArray;
|
|
|
|
|
using TanArray = TArray<UlxTangible*>;
|
2023-09-02 01:33:11 -04:00
|
|
|
|
2023-09-25 18:00:34 -04:00
|
|
|
// A pointer to our world.
|
|
|
|
|
UPROPERTY()
|
|
|
|
|
TWeakObjectPtr<UWorld> World;
|
2023-09-02 01:33:11 -04:00
|
|
|
|
2024-02-02 15:48:27 -05:00
|
|
|
// A pointer to our game mode.
|
|
|
|
|
UPROPERTY()
|
|
|
|
|
TWeakObjectPtr<AIntegrationGameModeBase> GameMode;
|
|
|
|
|
|
2023-09-26 17:00:30 -04:00
|
|
|
// Given a tangible ID, look up the TangibleComponent of that actor.
|
2023-09-02 01:43:44 -04:00
|
|
|
UPROPERTY()
|
2023-09-26 17:00:30 -04:00
|
|
|
TMap<int64, UlxTangible*> IdToTangible;
|
2023-09-06 23:25:37 -04:00
|
|
|
|
2024-03-25 14:50:06 -04:00
|
|
|
// The Tangible ID of the posessed tangible, if any.
|
|
|
|
|
UlxTangible *PossessedTangible;
|
|
|
|
|
|
2023-09-02 01:33:11 -04:00
|
|
|
public:
|
2023-09-26 17:00:30 -04:00
|
|
|
UlxTangibleManager();
|
2023-09-06 23:25:37 -04:00
|
|
|
|
2023-09-02 01:39:35 -04:00
|
|
|
// Initialize the tangible manager.
|
|
|
|
|
//
|
2024-02-02 15:48:27 -05:00
|
|
|
void Init(UWorld *world, AIntegrationGameModeBase *gamemode);
|
2023-09-02 01:33:11 -04:00
|
|
|
|
2023-09-25 18:00:34 -04:00
|
|
|
// Get a pointer to our world.
|
|
|
|
|
//
|
|
|
|
|
UWorld* GetWorld() const override { return World.Get(); }
|
|
|
|
|
|
2024-02-02 15:48:27 -05:00
|
|
|
// Get a pointer to our game mode.
|
|
|
|
|
AIntegrationGameModeBase *GetGameMode() { return GameMode.Get(); }
|
|
|
|
|
|
2023-09-02 01:43:44 -04:00
|
|
|
// Get the tangible if it exists, otherwise return NULL
|
2023-09-26 19:26:09 -04:00
|
|
|
//
|
|
|
|
|
UlxTangible* GetTangible(int64 id) const;
|
2023-09-02 01:33:11 -04:00
|
|
|
|
2023-09-02 01:43:44 -04:00
|
|
|
// Get the tangible if it exists, otherwise create it.
|
2023-09-26 19:26:09 -04:00
|
|
|
//
|
2023-09-26 17:00:30 -04:00
|
|
|
UlxTangible* MakeTangible(int64 id);
|
2023-09-02 01:33:11 -04:00
|
|
|
|
2023-09-02 01:43:44 -04:00
|
|
|
// Delete the tangible.
|
2023-09-26 19:26:09 -04:00
|
|
|
//
|
2023-09-02 01:43:44 -04:00
|
|
|
void DeleteTangible(int64 id);
|
2023-09-06 23:25:37 -04:00
|
|
|
|
2023-09-26 19:26:09 -04:00
|
|
|
// Get an array of all tangibles.
|
2023-09-07 23:50:49 -04:00
|
|
|
//
|
2023-09-26 19:26:09 -04:00
|
|
|
TanArray GetAllTangibles() const;
|
|
|
|
|
|
2024-09-11 16:07:47 -04:00
|
|
|
// Get the currently-possessed tangible.
|
2024-03-25 14:50:06 -04:00
|
|
|
//
|
2024-09-11 16:07:47 -04:00
|
|
|
// This can be nullptr if no tangible is possessed.
|
2024-03-25 14:50:06 -04:00
|
|
|
//
|
2024-09-11 16:07:47 -04:00
|
|
|
UlxTangible *GetPossessedTangible() { return PossessedTangible; }
|
|
|
|
|
|
|
|
|
|
// Set the currently-possessed tangible.
|
|
|
|
|
//
|
2024-09-24 22:13:56 -04:00
|
|
|
void SetPossessedTangible(UlxTangible *tan) { PossessedTangible = tan; }
|
2024-03-25 14:50:06 -04:00
|
|
|
|
2023-09-26 19:26:09 -04:00
|
|
|
// Update the 'NearAccordingToLuprex' flags.
|
|
|
|
|
//
|
2023-09-28 14:32:48 -04:00
|
|
|
// Also creates stub tangibles for every Id in the list.
|
2023-09-07 23:50:49 -04:00
|
|
|
//
|
2023-09-28 14:32:48 -04:00
|
|
|
void UpdateNearAccordingToLuprex(IdView near);
|
|
|
|
|
|
|
|
|
|
// Recalculate the 'NearAccordingToUnreal' flags.
|
|
|
|
|
//
|
|
|
|
|
void RecalcNearAccordingToUnreal(int64 player, double radius);
|
|
|
|
|
|
|
|
|
|
// Delete Far Tangibles.
|
|
|
|
|
//
|
|
|
|
|
// Any tangible whose 'NearAccordingToLuprex' and 'NearAccordingToUnreal'
|
|
|
|
|
// flags are both false is deleted. You probably want to update both
|
|
|
|
|
// flags by calling the two routines above before calling this.
|
|
|
|
|
//
|
|
|
|
|
void DeleteFarawayTangibles();
|
2023-09-26 19:26:09 -04:00
|
|
|
|
|
|
|
|
// Given an array of tangibles, return an array of tangible Ids.
|
2023-09-06 23:25:37 -04:00
|
|
|
//
|
2023-09-26 19:26:09 -04:00
|
|
|
static IdArray GetIds(const TanArray &tans);
|
2024-01-24 14:51:21 -05:00
|
|
|
|
|
|
|
|
// Convert a blueprint name to a blueprint class.
|
|
|
|
|
//
|
|
|
|
|
UClass *GetTangibleClass(const FString &name);
|
2024-09-24 22:56:49 -04:00
|
|
|
|
|
|
|
|
// Get the Animation Queue Changed function from a UClass.
|
|
|
|
|
//
|
|
|
|
|
static UFunction *GetAnimationQueueChanged(UClass *uclass);
|
2023-09-02 01:33:11 -04:00
|
|
|
};
|
2023-09-06 23:25:37 -04:00
|
|
|
|