// Project Lab - NHTV Igad

#pragma once

#include "Blueprint/UserWidget.h"
#include "StatBar.generated.h"

enum class EBarColor
{
	Green = 0,
	Red,
	Blue,
	Purple,
	GreenGradient = 0x80,
	BlueGradient
};

/**
 * 
 */
UCLASS()
class UNREALPROJECT_API UStatBar : public UUserWidget
{
	GENERATED_BODY()

public:
	UStatBar(const FObjectInitializer& init);
	void NativeConstruct() override;
	void NativeTick(const FGeometry& MyGeometry, float InDeltaTime) override;

	void SetStat(int32 newStat, int32 max, bool applyAnimation);
	void SetStat(float newStat, bool applyAnimation);
	void SetBlocked(float newBlocked);
	void SetBarColor(EBarColor colorID);
	
	UPROPERTY(EditDefaultsOnly, Category = "Stat Bar")
	float damageAnimationDuration;
	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Stat Bar")
	bool showText;

private:
	float m_damageAnimation;
	float m_lastValue;
	float m_currentValue;
	UImage* m_base;
	UImage* m_blocked;
	UImage* m_damage;
	UTextBlock* m_text;
};
