Tangible creation and destruction in place

This commit is contained in:
2023-09-28 14:32:48 -04:00
parent 9116a7b8fe
commit 642b444d13
7 changed files with 174 additions and 32 deletions

View File

@@ -89,19 +89,83 @@ public:
FlxAnimTracker AnimTracker;
// Current Plane.
FString Plane;
FName Plane;
// True if luprex thinks this object is Near the player.
bool NearAccordingToLuprex;
// True if unreal thinks this object is Near the player.
bool NearAccordingToUnreal;
public:
// Initialize a new tangible.
//
// This links the tangible to its TangibleManager and
// sets the tangible's ID.
//
void Init(UlxTangibleManager *tm, int64 id);
// Destroy a tangible.
//
// Delete the actor associated with the tangible, if any,
// and clean up everything else.
//
void Destroy();
// Get the actor associated with this tangible.
//
// Note that this may return nullptr: it is valid for a
// tangible to have no actor associated with it. This
// is most commonly the case if the blueprint class of
// the tangible is set to nullptr.
//
// Also bear in mind that if a tangible changes its blueprint
// class, then the actor will have to be deleted and
// recreated. In that case, GetActor will return a different
// pointer than before the blueprint change.
//
AActor* GetActor() const { return CurrentActor.Get(); }
// Get the location of the tangible.
//
// Note that if the actor is nullptr, the location is always
// at the origin.
//
FVector GetLocation() const;
// Check a blueprint class to see if it is valid as a Tangible.
//
// In order for a blueprint class to be used as a tangible,
// it must implement the interface IlxTangibleInterface.
// This function also returns true for nullptr.
//
static bool BlueprintIsTangible(TSubclassOf<AActor> bp);
// Change the blueprint class of the tangible.
//
// This requires the deletion and recreation of the Actor.
// The blueprint class must satisfy 'BlueprintIsTangible' above.
//
// It is legal to pass in nullptr for the blueprint class.
// Whenever the blueprint class is nullptr, the Actor is
// also nullptr. Ie, a tangible will have no Actor associated
// with it if its blueprint class is nullptr.
//
void SetActorBlueprintClass(TSubclassOf<AActor> bp);
AActor* GetActor() const { return CurrentActor.Get(); }
// Update the animation queue from Luprex.
//
// This reads the animation queue, and then based on
// what is new in the animation queue, it calls into
// the Actor's TangibleInterface, calling methods such
// as 'StartAnimation' and 'AbortAnimation' as necessary.
//
// If the animation queue specifies a blueprint change,
// this function will eventually implement that by calling
// SetActorBlueprintClass above. This is not implemented
// yet.
//
void UpdateAnimationQueue(std::string_view aq);
public:
UFUNCTION(BlueprintCallable, Meta = (DefaultToSelf = "target"), Category = Luprex)