Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma once
- #include "CoreMinimal.h"
- #include "Components/ActorComponent.h"
- #include "Widgets/FloatingCombatText.h"
- #include "DamageNumberWidgetPoolManager.generated.h"
- UCLASS(ClassGroup = (Custom), meta = (BlueprintSpawnableComponent))
- class YOURGAME_API UDamageNumberWidgetPoolManager : public UActorComponent
- {
- GENERATED_BODY()
- public:
- UDamageNumberWidgetPoolManager();
- virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
- UFUNCTION(BlueprintCallable)
- UFloatingCombatText* GetFloatingCombatTextFromPool(const FText& InText, const FVector& InLocation, const FLinearColor& InColor, const FVector2D& InScale);
- void ReturnFloatingCombatTextToPool(UFloatingCombatText* Widget);
- protected:
- virtual void BeginPlay() override;
- private:
- UPROPERTY(EditDefaultsOnly, Category = "Pool")
- TSubclassOf<UFloatingCombatText> FloatingCombatTextClass;
- TArray<UFloatingCombatText*> InactiveWidgetPool;
- TArray<UFloatingCombatText*> ActiveWidgetPool;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement