7#include "Components/BoxComponent.h"
8#include "Components/StaticMeshComponent.h"
9#include "GameFramework/Pawn.h"
20 RootComp = CreateDefaultSubobject<USceneComponent>(TEXT(
"Root"));
23 BoxCollision = CreateDefaultSubobject<UBoxComponent>(TEXT(
"BoxCollision"));
26 BoxCollision->SetCollisionEnabled(ECollisionEnabled::QueryOnly);
27 BoxCollision->SetCollisionObjectType(ECollisionChannel::ECC_WorldDynamic);
28 BoxCollision->SetCollisionResponseToAllChannels(ECollisionResponse::ECR_Ignore);
29 BoxCollision->SetCollisionResponseToChannel(ECollisionChannel::ECC_Pawn, ECollisionResponse::ECR_Overlap);
34 Door_Left = CreateDefaultSubobject<UStaticMeshComponent>(TEXT(
"Door_Left"));
35 Door_Left->SetupAttachment(RootComponent);
37 Door_Right = CreateDefaultSubobject<UStaticMeshComponent>(TEXT(
"Door_Right"));
43 PrimaryActorTick.bCanEverTick =
false;
51 if (
auto EventManager = UBroadcastManager::Get(
this))
64 if ( InGateID != this->
GateID)
113 if ( OtherActor ==
nullptr)
116 if ( OtherActor ==
this)
126void AGate::OnOverlapBegin(UPrimitiveComponent* OverlappedComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex,
bool bFromSweep,
const FHitResult& SweepResult)
130 if (
auto Pawn = Cast<APawn>(OtherActor) )
141void AGate::OnOverlapEnd(UPrimitiveComponent* OverlappedComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex)
145 if (
auto Pawn = Cast<APawn>(OtherActor) )
출입문 개폐를 담당하는 게이트 액터를 선언합니다.
bool IsPlayerActor(const AActor *OtherActor) const
겹친 액터가 플레이어인지 판별합니다.
virtual void BeginPlay() override
브로드캐스트 구독 등 초기화를 수행합니다.
AGate()
컴포넌트 계층을 구성하는 기본 생성자입니다.
void PlayCloseDoorAnimation()
문을 닫을 때 재생할 블루프린트 애니메이션입니다.
TObjectPtr< class USceneComponent > RootComp
TObjectPtr< class UBoxComponent > BoxCollision
void OpenDoor()
문을 여는 동작을 트리거합니다.
void OnDoorMessage(int32 InGateID, bool Open, AActor *EventInstigator)
외부 시스템에서 전달된 개폐 메시지를 처리합니다.
void PlayOpenDoorAnimation()
문을 열 때 재생할 블루프린트 애니메이션입니다.
TObjectPtr< class UStaticMeshComponent > Door_Right
void CloseDoor()
문을 닫는 동작을 트리거합니다.
void OnOverlapEnd(UPrimitiveComponent *OverlappedComp, AActor *OtherActor, UPrimitiveComponent *OtherComp, int32 OtherBodyIndex)
플레이어가 감지 범위에서 벗어났을 때 호출됩니다.
void OnOverlapBegin(UPrimitiveComponent *OverlappedComp, AActor *OtherActor, UPrimitiveComponent *OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult &SweepResult)
플레이어가 감지 범위에 들어왔을 때 호출됩니다.
TArray< TObjectPtr< class APawn > > OverlappingPawns
TObjectPtr< class UStaticMeshComponent > Door_Left