diff --git a/Content/CombatSystem/Blueprints/BP_CombatPlayerController.uasset b/Content/CombatSystem/Blueprints/BP_CombatPlayerController.uasset index fbd378cd..edd8317c 100644 Binary files a/Content/CombatSystem/Blueprints/BP_CombatPlayerController.uasset and b/Content/CombatSystem/Blueprints/BP_CombatPlayerController.uasset differ diff --git a/Content/CombatSystem/Blueprints/BP_D1GameMode.uasset b/Content/CombatSystem/Blueprints/BP_D1GameMode.uasset index 345e76b3..62be4e8d 100644 Binary files a/Content/CombatSystem/Blueprints/BP_D1GameMode.uasset and b/Content/CombatSystem/Blueprints/BP_D1GameMode.uasset differ diff --git a/Content/CombatSystem/UI/BP_CombatHUD.uasset b/Content/CombatSystem/UI/BP_CombatHUD.uasset new file mode 100644 index 00000000..d7290d97 Binary files /dev/null and b/Content/CombatSystem/UI/BP_CombatHUD.uasset differ diff --git a/Source/D1/CombatPlayerController.cpp b/Source/D1/CombatPlayerController.cpp index b5467f43..15b9251f 100644 --- a/Source/D1/CombatPlayerController.cpp +++ b/Source/D1/CombatPlayerController.cpp @@ -4,12 +4,14 @@ #include "CombatPlayerController.h" #include "UI/UI_MainHUD.h" -void ACombatPlayerController::BeginPlay() -{ - if (MainHUDClass) - { - UUI_MainHUD* mainHUD = CreateWidget(this, MainHUDClass); - mainHUD->AddToViewport(); - } - -} +//void ACombatPlayerController::BeginPlay() +//{ +// Super::BeginPlay(); +// +// //MainHUD ·Î ¿Å±è +// if (MainHUDClass) +// { +// UUI_MainHUD* mainHUD = CreateWidget(this, MainHUDClass); +// mainHUD->AddToViewport(); +// } +//} diff --git a/Source/D1/CombatPlayerController.h b/Source/D1/CombatPlayerController.h index 4691b40d..7ea584ba 100644 --- a/Source/D1/CombatPlayerController.h +++ b/Source/D1/CombatPlayerController.h @@ -14,10 +14,11 @@ class D1_API ACombatPlayerController : public APlayerController { GENERATED_BODY() -public: - virtual void BeginPlay() override; +//public: +// virtual void BeginPlay() override; -private: - UPROPERTY(EditDefaultsOnly, Category = UI) - TSubclassOf MainHUDClass; +//CombatHUD ·Î ¿Å±è +//private: +// UPROPERTY(EditDefaultsOnly, Category = UI) +// TSubclassOf MainHUDClass; }; diff --git a/Source/D1/UI/CombatHUD.cpp b/Source/D1/UI/CombatHUD.cpp new file mode 100644 index 00000000..d3bb3773 --- /dev/null +++ b/Source/D1/UI/CombatHUD.cpp @@ -0,0 +1,21 @@ +// Fill out your copyright notice in the Description page of Project Settings. + + +#include "UI/CombatHUD.h" +#include "UI/UI_MainHUD.h" + +void ACombatHUD::BeginPlay() +{ + Super::BeginPlay(); + + UWorld* World = GetWorld(); + if (World) + { + APlayerController* Contorller = World->GetFirstPlayerController(); + if (Contorller && MainUI) + { + UUI_MainHUD* outputUI = CreateWidget(Contorller, MainUI); + outputUI->AddToViewport(); + } + } +} diff --git a/Source/D1/UI/CombatHUD.h b/Source/D1/UI/CombatHUD.h new file mode 100644 index 00000000..15a1d7f7 --- /dev/null +++ b/Source/D1/UI/CombatHUD.h @@ -0,0 +1,22 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +#pragma once + +#include "CoreMinimal.h" +#include "GameFramework/HUD.h" +#include "CombatHUD.generated.h" + +/** + * + */ +UCLASS() +class D1_API ACombatHUD : public AHUD +{ + GENERATED_BODY() + +protected: + virtual void BeginPlay() override; +private: + UPROPERTY(EditDefaultsOnly, Category = UI) + TSubclassOf MainUI; +}; diff --git a/Source/D1/UI/UI_StatBar.h b/Source/D1/UI/UI_StatBar.h index 604c5835..3dcbf40e 100644 --- a/Source/D1/UI/UI_StatBar.h +++ b/Source/D1/UI/UI_StatBar.h @@ -21,7 +21,7 @@ public: //Delegate void StatBarStatValueUpdated(EStats stat, float value); public: UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (BindWidget)) - class UProgressBar* StatBar; + TObjectPtr StatBar; UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Initialization , meta=(AllowPrivateAccess="true")) EStats StatType;