// Project Lab - NHTV Igad #pragma once #include "Blueprint/UserWidget.h" #include "Timer.generated.h" /** * */ UCLASS() class UNREALPROJECT_API UTimer : public UUserWidget { GENERATED_BODY() public: // Calbacks handling timer changes UFUNCTION(BlueprintImplementableEvent, Category = "HUDTimer") void OnSetTimer(float rate); UFUNCTION(BlueprintImplementableEvent, Category = "HUDTimer") void OnHide(); // Play animation UFUNCTION(BlueprintImplementableEvent, Category = "HUDTimer") void OnShow(); // Play animation void NativeConstruct(); void NativeTick(const FGeometry& MyGeometry, float InDeltaTime) override; UFUNCTION(BlueprintCallable, Category = "HUDTimer") void SetTimer(float duration, bool reset = true); UFUNCTION(BlueprintCallable, Category = "HUDTimer") void SetText(const FString& text); UFUNCTION(BlueprintCallable, Category = "HUDTimer") float GetTime() const { return m_time; } private: float m_time; float m_duration; UImage* m_clock; UTextBlock* m_text; UTextBlock* m_timerText; };