





EnemyAOE.cpp
#include "Enemy/FEnemyAOE.h"
#include "Components/SphereComponent.h"
#include "FGameFunctionLibrary.h"
// Sets default values
AFEnemyAOE::AFEnemyAOE()
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
SphereComp = CreateDefaultSubobject<USphereComponent>(TEXT("SphereComponent"));
SetRootComponent(SphereComp);
SphereComp->OnComponentBeginOverlap.AddDynamic(this, &AFEnemyAOE::OnComponentBeginOverlap);
SphereComp->OnComponentEndOverlap.AddDynamic(this, &AFEnemyAOE::OnComponentEndOverlap);
}
// Called when the game starts or when spawned
void AFEnemyAOE::BeginPlay()
{
Super::BeginPlay();
FTimerHandle TimerHandle;
GetWorldTimerManager().SetTimer(TimerHandle, this, &AFEnemyAOE::TickDamage, 0.5f, true);
SetLifeSpan(5.0f);
}
// Called every frame
void AFEnemyAOE::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}
void AFEnemyAOE::OnComponentBeginOverlap(UPrimitiveComponent* OverlappedComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
{
if (OtherActor->ActorHasTag(TEXT("Player")))
{
bPlayerCome = true;
TargetActor = OtherActor;
}
}
void AFEnemyAOE::OnComponentEndOverlap(UPrimitiveComponent* OverlappedComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex)
{
if (OtherActor->ActorHasTag(TEXT("Player")))
{
bPlayerCome = false;
}
}
void AFEnemyAOE::TickDamage()
{
if (bPlayerCome)
{
TArray<TSubclassOf<class UFBuff>> BuffClassesToApply;
UFGameFunctionLibrary::ApplyDamage(this, TargetActor, 2.0f, BuffClassesToApply);
}
}'개발일지' 카테고리의 다른 글
| 09-02~ 09-03 Boss 패턴 3, FireBreath, Boss Phase2 변환 과정 추가 (0) | 2024.09.03 |
|---|---|
| 08-28~ 08-29 버그수정, 이팩트 Sound작업 (0) | 2024.09.02 |
| 08-22~ 08-23 보스 몬스터 기본공격 수정 및 패턴1, 중간보스 쉴드 버그 수정 (0) | 2024.08.23 |
| 08-20~08-21 EQS 작업, 임시 Projectile 생성, Wolf, 보스 기본공격 (0) | 2024.08.21 |
| 08-13~ 08-14 BTS_UpdateDistance, Shield 변경 사항, Enemy Smooth Turn, Boss 기초작업 (1) | 2024.08.14 |