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-25 18:00:34 -04:00
|
|
|
#include "TangibleComponent.h"
|
2023-09-02 01:33:11 -04:00
|
|
|
#include "TangibleManager.generated.h"
|
|
|
|
|
|
2023-09-25 14:25:24 -04:00
|
|
|
UCLASS()
|
|
|
|
|
class INTEGRATION_API UTangibleManager : 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-07 23:50:49 -04:00
|
|
|
// Import these types into our Namespace.
|
2023-09-08 01:52:30 -04:00
|
|
|
using IdArray = CommonTypes::IdArray;
|
|
|
|
|
using IdView = CommonTypes::IdView;
|
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
|
|
|
|
2023-09-25 18:00:34 -04:00
|
|
|
// A pointer to uclass TangibleActor. This is the class
|
|
|
|
|
// of actors that we create (for now).
|
2023-09-02 01:39:35 -04:00
|
|
|
UPROPERTY()
|
|
|
|
|
TSubclassOf<AActor> ClassTangibleActor;
|
2023-09-02 01:33:11 -04:00
|
|
|
|
2023-09-02 01:43:44 -04:00
|
|
|
// Given a tangible ID, look up actor pointer (or NULL if actor was deleted)
|
|
|
|
|
UPROPERTY()
|
2023-09-25 18:00:34 -04:00
|
|
|
TMap<int64, AActor*> IdToActor;
|
2023-09-06 23:25:37 -04:00
|
|
|
|
2023-09-25 18:00:34 -04:00
|
|
|
// Player's tangible Id.
|
|
|
|
|
int64 Player;
|
2023-09-06 23:25:37 -04:00
|
|
|
|
|
|
|
|
// Tangibles near the actor.
|
2023-09-07 23:50:49 -04:00
|
|
|
IdView Near;
|
2023-09-06 23:25:37 -04:00
|
|
|
|
2023-09-02 01:33:11 -04:00
|
|
|
public:
|
2023-09-25 14:25:24 -04:00
|
|
|
UTangibleManager();
|
2023-09-06 23:25:37 -04:00
|
|
|
|
2023-09-02 01:39:35 -04:00
|
|
|
// Initialize the tangible manager.
|
|
|
|
|
//
|
|
|
|
|
void Init(UWorld *world, UClass* tanact);
|
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(); }
|
|
|
|
|
|
2023-09-02 01:43:44 -04:00
|
|
|
// Get the tangible if it exists, otherwise return NULL
|
2023-09-25 18:00:34 -04:00
|
|
|
UTangibleComponent* GetTangible(int64 id);
|
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-25 18:00:34 -04:00
|
|
|
UTangibleComponent* MakeTangible(int64 id);
|
2023-09-02 01:33:11 -04:00
|
|
|
|
2023-09-02 01:43:44 -04:00
|
|
|
// Delete the tangible.
|
|
|
|
|
void DeleteTangible(int64 id);
|
2023-09-06 23:25:37 -04:00
|
|
|
|
|
|
|
|
// Get/Set the Id of the actor.
|
|
|
|
|
//
|
2023-09-25 18:00:34 -04:00
|
|
|
int64 GetPlayer() const { return Player; };
|
|
|
|
|
void SetPlayer(int64 id) { Player = id; }
|
2023-09-06 23:25:37 -04:00
|
|
|
|
2023-09-07 23:50:49 -04:00
|
|
|
// 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.
|
2023-09-06 23:25:37 -04:00
|
|
|
//
|
2023-09-07 23:50:49 -04:00
|
|
|
IdArray GetLive();
|
2023-09-02 01:33:11 -04:00
|
|
|
};
|
2023-09-06 23:25:37 -04:00
|
|
|
|