5#include "Components/BoxComponent.h"
6#include "DrawDebugHelpers.h"
8#include "GameFramework/PlayerController.h"
13 PrimaryActorTick.bCanEverTick =
true;
17 TriggerBox = CreateDefaultSubobject<UBoxComponent>(TEXT(
"TriggerBox"));
21 TriggerBox->SetBoxExtent(FVector(100.0f, 100.0f, 100.0f));
25 TriggerBox->SetCollisionEnabled(ECollisionEnabled::QueryOnly);
26 TriggerBox->SetCollisionResponseToAllChannels(ECR_Ignore);
27 TriggerBox->SetCollisionResponseToChannel(ECC_Pawn, ECR_Overlap);
45 Super::Tick(DeltaTime);
49 FVector BoxCenter =
TriggerBox->GetComponentLocation();
50 FVector BoxExtent =
TriggerBox->GetScaledBoxExtent();
51 FRotator BoxRotation =
TriggerBox->GetComponentRotation();
60 BoxRotation.Quaternion(),
70 FString StatusText =
bIsTriggered ? TEXT(
"[TRIGGERED]") : TEXT(
"[ACTIVE]");
71 FColor TextColor =
bIsTriggered ? FColor::Red : FColor::Green;
73 FVector TextLocation = BoxCenter + FVector(0.0f, 0.0f, BoxExtent.Z + 50.0f);
90 UPrimitiveComponent* OverlappedComponent, AActor* OtherActor,
91 UPrimitiveComponent* OtherComp, int32 OtherBodyIndex,
92 bool bFromSweep,
const FHitResult& SweepResult)
99 APlayerActor* PlayerActor = Cast<APlayerActor>(OtherActor);
Declares the player-controlled character actor.
YiSan 전반에서 사용하는 공용 인터페이스를 선언합니다.
#define PRINT_STRING(fmt,...)
TObjectPtr< class UBoxComponent > TriggerBox
트리거 영역을 정의하는 박스 컴포넌트
bool bIsTriggered
트리거 활성화 상태 (false = 활성화, true = 비활성화)
virtual void Tick(float DeltaTime) override
virtual void BeginPlay() override
FColor DebugBoxColor
디버그 박스 색상
virtual void OnActivate_Implementation()
bool bShowDebugBox
디버그 드로우 표시 여부
void OnTriggerBeginOverlap(UPrimitiveComponent *OverlappedComponent, AActor *OtherActor, UPrimitiveComponent *OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult &SweepResult)
트리거 박스 Overlap 시작 이벤트 핸들러
Main character driven directly by the player.