Files
Yamato/Source/MyProject3/SpaceShooterHUD.h
2025-04-16 13:57:06 +05:30

71 lines
2.2 KiB
C++

#pragma once
#include "CoreMinimal.h"
#include "GameFramework/HUD.h"
#include "SpaceShooterHUD.generated.h"
UCLASS()
class MYPROJECT3_API ASpaceShooterHUD : public AHUD
{
GENERATED_BODY()
public:
ASpaceShooterHUD();
virtual void DrawHUD() override;
protected:
UPROPERTY()
UFont* TextFont;
// Bar configuration
UPROPERTY(EditAnywhere, Category = "HUD|Bars")
float BarWidth = 200.0f;
UPROPERTY(EditAnywhere, Category = "HUD|Bars")
float BarHeight = 20.0f;
UPROPERTY(EditAnywhere, Category = "HUD|Bars")
float BarPadding = 10.0f;
UPROPERTY(EditAnywhere, Category = "HUD|Bars")
FLinearColor HealthBarColor = FLinearColor(1.0f, 0.0f, 0.0f, 1.0f); // Red
UPROPERTY(EditAnywhere, Category = "HUD|Bars")
FLinearColor ShieldBarColor = FLinearColor(0.0f, 0.5f, 1.0f, 1.0f); // Light Blue
UPROPERTY(EditAnywhere, Category = "HUD|Bars")
FLinearColor BackgroundBarColor = FLinearColor(0.0f, 0.0f, 0.0f, 0.5f); // Semi-transparent black
// Game Over Screen Configuration
UPROPERTY(EditAnywhere, Category = "HUD|GameOver")
float GameOverScale = 3.0f;
UPROPERTY(EditAnywhere, Category = "HUD|GameOver")
FLinearColor GameOverTextColor = FLinearColor(1.0f, 0.2f, 0.2f, 1.0f); // Bright red
UPROPERTY(EditAnywhere, Category = "HUD|GameOver")
FLinearColor StatsTextColor = FLinearColor(0.9f, 0.9f, 0.9f, 1.0f); // Off-white
UPROPERTY(EditAnywhere, Category = "HUD|GameOver")
FLinearColor RestartTextColor = FLinearColor(1.0f, 0.843f, 0.0f, 1.0f); // Gold
UPROPERTY(EditAnywhere, Category = "HUD|GameOver")
float PulsateSpeed = 2.0f;
UPROPERTY(EditAnywhere, Category = "HUD|GameOver")
float PulsateMinAlpha = 0.7f;
UPROPERTY(EditAnywhere, Category = "HUD|GameOver")
float PulsateMaxAlpha = 1.0f;
private:
void DrawGameplayHUD();
void DrawGameOverScreen();
void DrawStatusBars();
class ASpaceShooterGameMode* GetGameMode() const;
class ASpaceshipPawn* GetPlayerPawn() const;
float GameOverStartTime;
void DrawGameOverBackground();
void DrawGameOverText(const FString& Text, const FVector2D& Position, const FLinearColor& Color, float Scale = 1.0f);
};