// 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 "Tangible.generated.h" class UlxTangibleManager; // This class does not need to be modified. UINTERFACE(Blueprintable) class UlxTangibleInterface : public UInterface { GENERATED_BODY() }; /** * * IlxTangibleInterface * * This class implements the interface that an Actor must implement * in order for that Actor to be usable as a Tangible. * */ class INTEGRATION_API IlxTangibleInterface { GENERATED_BODY() // Add interface functions to this class. This is the class that will be inherited to implement this interface. public: UFUNCTION(BlueprintImplementableEvent, Category = "Tangible Functionality") bool StartAnimation(ElxAnimationMode mode, const FlxAnimationStep& step); UFUNCTION(BlueprintImplementableEvent, Category = "Tangible Functionality") bool AbortAnimation(int64 hash); }; /** * * UlxTangible * * The Tangible stores all the data we need for a tangible, * such as the animation queue and so forth. * * From time to time, a tangible can change its blueprint class. * To do that, we have to delete and recreate the actor. This * is all set up so that it is possible to do that. * * The tangible has a place to store an Actor pointer. This * actor pointer is allowed to be nullptr, especially in the * case that the blueprint hasn't been set yet. * * This also serves as a repository for blueprint functions * that operate on tangible actors. * */ UCLASS() class INTEGRATION_API UlxTangible : public UObject { GENERATED_BODY() public: UlxTangible(); // My Tangible Manager. UPROPERTY() TObjectPtr Manager; // The tangible ID. UPROPERTY() uint64 TangibleId; UPROPERTY() TWeakObjectPtr CurrentActor; // The blueprint class of the actor. UPROPERTY() TSubclassOf ActorBlueprint; // Animation tracker FlxAnimTracker AnimTracker; // Current Plane. FString Plane; // True if luprex thinks this object is Near the player. bool NearAccordingToLuprex; public: void Init(UlxTangibleManager *tm, int64 id); static bool BlueprintIsTangible(TSubclassOf bp); void SetActorBlueprintClass(TSubclassOf bp); AActor* GetActor() const { return CurrentActor.Get(); } public: UFUNCTION(BlueprintCallable, Meta = (DefaultToSelf = "target"), Category = Luprex) static FString GetTangiblePlane(AActor* target); UFUNCTION(BlueprintCallable, Meta = (DefaultToSelf = "target"), Category = Luprex) static void SetTangiblePlane(AActor* target, const FString& plane); }; /** * * UlxTangibleComponent * * The TangibleComponent holds a pointer to the Tangible. * This is the only purpose it serves: to make it possible to * have the Actor point to its corresponding Tangible. * * The TangibleComponent is procedurally inserted into the Actor. * The TangibleComponent is not visible to blueprints. * */ UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) ) class INTEGRATION_API UlxTangibleComponent : public UActorComponent { GENERATED_BODY() public: UlxTangibleComponent() : Tangible(nullptr) {} // The actor that we're a part of. UPROPERTY() TWeakObjectPtr Tangible; };