Move tangible state into TangibleComponent
This commit is contained in:
56
Source/Integration/TangibleComponent.h
Normal file
56
Source/Integration/TangibleComponent.h
Normal file
@@ -0,0 +1,56 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Components/ActorComponent.h"
|
||||
#include "AnimQueue.h"
|
||||
#include "TangibleComponent.generated.h"
|
||||
|
||||
/*
|
||||
* TangibleComponent
|
||||
*
|
||||
* The TangibleManager procedurally injects a TangibleComponent
|
||||
* into the actor. This gives us a place to store tangible-specific
|
||||
* actor properties, such as the tangible Id, the animation queue,
|
||||
* and so forth.
|
||||
*
|
||||
* To cooperate the with the garbage collector, don't store pointers
|
||||
* to TangibleComponents in data structures. Instead, store a pointer
|
||||
* to the actor and then use GetComponentByClass to retrieve the
|
||||
* TangibleComponent on demand.
|
||||
*
|
||||
*/
|
||||
|
||||
class UTangibleManager;
|
||||
|
||||
UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
|
||||
class INTEGRATION_API UTangibleComponent : public UActorComponent
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
UTangibleComponent();
|
||||
|
||||
// The tangible ID.
|
||||
UPROPERTY()
|
||||
uint64 TangibleId;
|
||||
|
||||
// The actor that we're a part of.
|
||||
UPROPERTY()
|
||||
TWeakObjectPtr<AActor> Actor;
|
||||
|
||||
// Our tangible Manager.
|
||||
UPROPERTY()
|
||||
TWeakObjectPtr<UTangibleManager> TangibleManager;
|
||||
|
||||
// Animation tracker
|
||||
FlxAnimTracker AnimTracker;
|
||||
|
||||
// Current Plane.
|
||||
FString Plane;
|
||||
|
||||
void Init(UTangibleManager* tm, AActor* a, int64 id);
|
||||
|
||||
AActor* GetActor() const { return Actor.Get(); }
|
||||
};
|
||||
Reference in New Issue
Block a user