
소켓을 추가하여 기본공격이 손에서 범위형 공격을 할 수 있게 추가하였다.

3번공격은 양손에서 한번씩 공격하므로 Flip Flop을 사용하여 범위공격을 할 수 있게 추가하였다.


돌진할 때 Collision을 Pawn에 대해 잠깐 Overlap으로 바꿔 닿으면 Launch Character로 Player에게 데미지를 주면서 밀려나게 만들었다.

돌면서 데미지를 주는 공격이다.

돌진공격 후 한번 도는 패턴을 만들었다.
Shield.cpp
#include "Enemy/FShield.h"
#include "GameFramework/Character.h"
#include "GameFramework/PlayerController.h"
#include "Kismet/KismetSystemLibrary.h"
#include "FGameFunctionLibrary.h"
#include "Player/FAttributeComponent.h"
#include "Buff/FBuffComponent.h"
// Sets default values
AFShield::AFShield()
{
// 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;
StaticMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("ShiledMesh"));
StaticMesh->OnComponentBeginOverlap.AddDynamic(this, &AFShield::OnComponentBeginOverlap);
AttributeComp = CreateDefaultSubobject<UFAttributeComponent>(TEXT("AttributeComp"));
BuffComp = CreateDefaultSubobject<UFBuffComponent>(TEXT("BuffComp"));
}
// Called when the game starts or when spawned
void AFShield::BeginPlay()
{
Super::BeginPlay();
SetLifeSpan(LifeTime);
FTimerHandle TimerHandle;
GetWorldTimerManager().SetTimer(TimerHandle, this, &AFShield::ChangeBlack, 0.2f, false);
AttributeComp->OnHealthChanged.AddDynamic(this, &AFShield::OnHealthChanged);
if (bDamageShield)
{
GetWorldTimerManager().SetTimer(TimerHandle, this, &AFShield::OnDamage, BoomTimer, false);
}
}
============================생략============================
//Actor와 Shield와 겹쳤을때 밀어주는 로직
void AFShield::OnComponentBeginOverlap(UPrimitiveComponent* OverlappedComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
{
GEngine->AddOnScreenDebugMessage(-1, 3.0f, FColor::Blue, TEXT("Screen"));
if(OtherActor && OtherActor != this)
{
PushActor(OtherActor);
}
}
void AFShield::PushActor(AActor* ActorPush)
{
if(ActorPush)
{
ACharacter* Character = Cast<ACharacter>(ActorPush);
if(Character)
{
FVector ActorLocation = Character->GetActorLocation();
FVector ShiledLocation = GetActorLocation();
FVector Distance = (ActorLocation - ShiledLocation);
Distance.Normalize();
if (Distance.Size() < 300)
{
Character->LaunchCharacter(Distance * 3000, true, true);
}
}
}
}
void AFShield::ChangeBlack()
{
StaticMesh->SetCollisionResponseToChannel(ECollisionChannel::ECC_Pawn, ECollisionResponse::ECR_Block);
}
- 쉴드를 Player뿐만아니라 재사용성을 위해 Actor형으로 변경하였다.
'개발일지' 카테고리의 다른 글
| 08-28~ 08-29 버그수정, 이팩트 Sound작업 (0) | 2024.09.02 |
|---|---|
| 08-26~08-27 Boss 패턴 2 및 Boss Tree변경, Enemy AOE, Projectile (0) | 2024.08.28 |
| 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 |
| 08-08 ~ 08-09 WaterCannon 변경, 물폭풍 움직임 변경, Homing추가, ElitePlant 버그수정 - 위치값 변경 (0) | 2024.08.09 |