Files
integration/Source/Integration/TangibleManager.h

84 lines
2.0 KiB
C++

// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "UObject/NoExportTypes.h"
#include "CommonTypes.h"
#include "Tangible.h"
#include "TangibleManager.generated.h"
UCLASS()
class INTEGRATION_API UlxTangibleManager : public UObject
{
GENERATED_BODY()
public:
// Types used frequently.
using IdView = CommonTypes::IdView;
using IdArray = CommonTypes::IdArray;
using TanArray = TArray<UlxTangible*>;
// A pointer to our world.
UPROPERTY()
TWeakObjectPtr<UWorld> World;
// Given a tangible ID, look up the TangibleComponent of that actor.
UPROPERTY()
TMap<int64, UlxTangible*> IdToTangible;
public:
UlxTangibleManager();
// Initialize the tangible manager.
//
void Init(UWorld *world);
// Get a pointer to our world.
//
UWorld* GetWorld() const override { return World.Get(); }
// Get the tangible if it exists, otherwise return NULL
//
UlxTangible* GetTangible(int64 id) const;
// Get the tangible if it exists, otherwise create it.
//
UlxTangible* MakeTangible(int64 id);
// Delete the tangible.
//
void DeleteTangible(int64 id);
// Get an array of all tangibles.
//
TanArray GetAllTangibles() const;
// Update the 'NearAccordingToLuprex' flags.
//
// Also creates stub tangibles for every Id in the list.
//
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();
// Given an array of tangibles, return an array of tangible Ids.
//
static IdArray GetIds(const TanArray &tans);
// Convert a blueprint name to a blueprint class.
//
UClass *GetTangibleClass(const FString &name);
};