parent
be066a599f
commit
d749211174
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -50,30 +50,12 @@ ABossEnemy::ABossEnemy()
|
|||
|
||||
void ABossEnemy::BeginPlay()
|
||||
{
|
||||
//Blueprint에서 UMG 생성
|
||||
|
||||
Super::BeginPlay();
|
||||
|
||||
MainWeaponCollisionComponent->SetCollisionMeshComponent(WeaponMeshComponent);
|
||||
MainWeaponCollisionComponent->AddActorToIgnore(this);
|
||||
|
||||
APlayerController* playerController = UGameplayStatics::GetPlayerController(GetWorld(), 0);
|
||||
if(!playerController)
|
||||
return;
|
||||
|
||||
UWorld* World = GetWorld();
|
||||
if (World)
|
||||
{
|
||||
APlayerController* Contorller = World->GetFirstPlayerController();
|
||||
if(!Controller) //TODO : 임시
|
||||
{
|
||||
UUI_BossHealth* BossHealthRef = CreateWidget<UUI_BossHealth>(Contorller, UUI_BossHealth::StaticClass());
|
||||
if (BossHealthRef) //ExposeOnSpawn 대용으로 사용
|
||||
{
|
||||
BossHealthWidget = BossHealthRef;
|
||||
BossHealthRef->AddToViewport();
|
||||
BossHealthWidget->InitializeWidget(StatsComponent);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ABossEnemy::OnTargetSet(AActor* NewTarget)
|
||||
|
|
|
@ -49,5 +49,8 @@ private:
|
|||
FName WeaponHandSocketName;
|
||||
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, meta=(AllowPrivateAccess="true"))
|
||||
TObjectPtr<class UUI_BossHealth> BossHealthWidget;
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(AllowPrivateAccess="true"))
|
||||
TSubclassOf<class UUI_BossHealth> BossHealthClass;
|
||||
|
||||
|
||||
};
|
||||
|
|
|
@ -77,7 +77,8 @@ AMasterAI::AMasterAI()
|
|||
StatsComponent->SetMaxStatValue(EStats::Armor, 100.f);
|
||||
StatsComponent->SetBaseStatValue(EStats::Damage, 25.f);
|
||||
StatsComponent->SetMaxStatValue(EStats::Damage, 300.f);
|
||||
|
||||
StatsComponent->InitializeStats();
|
||||
|
||||
// Setting MainWeaponCollisionComponent
|
||||
// Setting OnHit Func is Child Class
|
||||
MainWeaponCollisionComponent = CreateDefaultSubobject<UCollisionComponent>(TEXT("CollisionComponent"));
|
||||
|
@ -100,10 +101,12 @@ AMasterAI::AMasterAI()
|
|||
|
||||
void AMasterAI::BeginPlay()
|
||||
{
|
||||
// Call the base class
|
||||
Super::BeginPlay();
|
||||
|
||||
StatsComponent->InitializeStats();
|
||||
Super::BeginPlay();
|
||||
|
||||
// BP의 BeginPlay가 먼저 호출됨 (ReceiveBeginPlay)
|
||||
// 따라서 생성자로 올림
|
||||
//StatsComponent->InitializeStats();
|
||||
}
|
||||
|
||||
float AMasterAI::TakeDamage(float Damage, FDamageEvent const& DamageEvent, AController* EventInstigator, AActor* DamageCauser)
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "UI/UI_BossHealth.h"
|
||||
|
||||
#include "UI_HealthBar.h"
|
||||
#include "Components/StatsComponent.h"
|
||||
#include "Components/TextBlock.h"
|
||||
|
||||
void UUI_BossHealth::NativeConstruct()
|
||||
{
|
||||
/*
|
||||
* TODO :
|
||||
* Blueprint로 호출할때는 호출되지만
|
||||
* C++로 호출할 때는 nullptr로 들어옴
|
||||
*/
|
||||
Super::NativeConstruct();
|
||||
HealthBar = Cast<UUI_HealthBar>(GetWidgetFromName(TEXT("HealthBarWidget")));
|
||||
if(HealthBar)
|
||||
//HealthBar->InitializeHealthBar(StatsComponent, EStats::Health);
|
||||
|
||||
Test1 = Cast<UTextBlock>(GetWidgetFromName(TEXT("Test1Widget")));
|
||||
Test2 = Cast<UTextBlock>(GetWidgetFromName(TEXT("Test2Widget")));
|
||||
// ensure(Test1);
|
||||
// ensure(Test2);
|
||||
}
|
||||
|
||||
void UUI_BossHealth::InitializeWidget(UStatsComponent* InputStatsComponent)
|
||||
{
|
||||
if(IsValid(InputStatsComponent))
|
||||
StatsComponent = InputStatsComponent;
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Blueprint/UserWidget.h"
|
||||
#include "UI_BossHealth.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class D1_API UUI_BossHealth : public UUserWidget
|
||||
{
|
||||
GENERATED_BODY()
|
||||
public:
|
||||
virtual void NativeConstruct() override;
|
||||
void InitializeWidget(class UStatsComponent* InputStatsComponent);
|
||||
private:
|
||||
UPROPERTY()
|
||||
TObjectPtr<class UUI_HealthBar> HealthBar;
|
||||
UPROPERTY()
|
||||
TObjectPtr<class UTextBlock> Test1;
|
||||
UPROPERTY()
|
||||
TObjectPtr<class UTextBlock> Test2;
|
||||
UPROPERTY()
|
||||
TObjectPtr<class UStatsComponent> StatsComponent;
|
||||
};
|
|
@ -30,6 +30,7 @@ private:
|
|||
bool bUsePlayerStatsComponent;
|
||||
|
||||
public:
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void InitializeHealthBar(UStatsComponent* InputStatsComponent, EStats InputStatType);
|
||||
|
||||
public:
|
||||
|
|
Loading…
Reference in New Issue