Files
integration/Source/Integration/TangibleManager.h

74 lines
1.6 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;
// A pointer to uclass TangibleActor. This is the class
// of actors that we create (for now).
UPROPERTY()
TSubclassOf<AActor> ClassTangibleActor;
// 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, UClass* tanact);
// 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 any tangibles that are in the near-list,
// if they don't already exist.
//
void UpdateNear(IdView near);
// Given an array of tangibles, return an array of tangible Ids.
//
static IdArray GetIds(const TanArray &tans);
};