KLingo Project Documentation 1.0.0
Unreal Engine 5.6 C++ Project Documentation
로딩중...
검색중...
일치하는것 없음
DestroyTrigger.cpp
이 파일의 문서화 페이지로 가기
1// Copyright (c) 2025 Doppleddiggong. All rights reserved. Unauthorized copying, modification, or distribution of this file, via any medium is strictly prohibited. Proprietary and confidential.
2
3
4#include "DestroyTrigger.h"
5
6#include "Food.h"
7#include "Components/BoxComponent.h"
8
9
10// Sets default values
12{
13 // Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
14 PrimaryActorTick.bCanEverTick = true;
15
16 Trigger = CreateDefaultSubobject<UBoxComponent>(TEXT("Trigger"));
17 SetRootComponent(Trigger);
18}
19
20// Called when the game starts or when spawned
22{
23 Super::BeginPlay();
24
25 Trigger->OnComponentBeginOverlap.AddDynamic(this, &ADestroyTrigger::BeginOverlap);
26}
27
28// Called every frame
29void ADestroyTrigger::Tick(float DeltaTime)
30{
31 Super::Tick(DeltaTime);
32}
33
34void ADestroyTrigger::BeginOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor,
35 UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
36{
37 if (AFood* Food = Cast<AFood>(OtherActor))
38 {
40 }
41}
42
43void ADestroyTrigger::Server_Destroy_Implementation(AActor* ActorToDestroy)
44{
45 ActorToDestroy->Destroy();
46}
47
virtual void Tick(float DeltaTime) override
class UBoxComponent * Trigger
void Server_Destroy(AActor *ActorToDestroy)
virtual void BeginPlay() override
void BeginOverlap(UPrimitiveComponent *OverlappedComponent, AActor *OtherActor, UPrimitiveComponent *OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult &SweepResult)
Definition Food.h:37