-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDamageArea.cpp
More file actions
46 lines (35 loc) · 1.27 KB
/
Copy pathDamageArea.cpp
File metadata and controls
46 lines (35 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// Fill out your copyright notice in the Description page of Project Settings.
#include "DamageArea.h"
// Sets default values
ADamageArea::ADamageArea(const class FObjectInitializer& PCIP)
{
// 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;
ProxBox = PCIP.CreateDefaultSubobject<UBoxComponent>(this, TEXT("ProxBox"));
RootComponent = ProxBox;
ProxBox->OnComponentBeginOverlap.AddDynamic(this, &ADamageArea::Prox);
Mesh = PCIP.CreateDefaultSubobject<UStaticMeshComponent>(this, TEXT("Mesh"));
Mesh->SetupAttachment(ProxBox);
Damage = 100;
}
// Called when the game starts or when spawned
void ADamageArea::BeginPlay()
{
Super::BeginPlay();
}
// Called every frame
void ADamageArea::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}
void ADamageArea::Prox_Implementation(class UPrimitiveComponent* HitComp, AActor* OtherActor,
UPrimitiveComponent* OtherComp, int32 OtherBodyIndex,
bool bFromSweep, const FHitResult & SweepResult)
{
if (OtherComp != OtherActor->GetRootComponent())
{
// don't collide w/ anything other than the actor's root component
return;
}
OtherActor->TakeDamage(Damage, FDamageEvent(), NULL, this);
}