77 lines
1.7 KiB
C++
77 lines
1.7 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:
|
|
// Import these types into our Namespace.
|
|
using IdArray = CommonTypes::IdArray;
|
|
using IdView = CommonTypes::IdView;
|
|
|
|
// 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;
|
|
|
|
// Player's tangible Id.
|
|
int64 Player;
|
|
|
|
// Tangibles near the actor.
|
|
IdView Near;
|
|
|
|
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);
|
|
|
|
// Get the tangible if it exists, otherwise create it.
|
|
UlxTangible* MakeTangible(int64 id);
|
|
|
|
// Delete the tangible.
|
|
void DeleteTangible(int64 id);
|
|
|
|
// Get/Set the Id of the actor.
|
|
//
|
|
int64 GetPlayer() const { return Player; };
|
|
void SetPlayer(int64 id) { Player = id; }
|
|
|
|
// Get/Set the list of tangibles near the player, according to Luprex.
|
|
//
|
|
IdView GetNear() const { return Near; }
|
|
void SetNear(IdView near) { Near = near; }
|
|
|
|
// Get the Live list.
|
|
//
|
|
// Efficiency note: this makes a copy of the array.
|
|
//
|
|
IdArray GetLive();
|
|
};
|
|
|