2020-12-01 11:32:20 +01:00
|
|
|
#include "TriggerOpenDoor.h"
|
|
|
|
|
|
|
|
UTriggerOpenDoor::UTriggerOpenDoor()
|
|
|
|
{
|
|
|
|
PrimaryComponentTick.bCanEverTick = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void UTriggerOpenDoor::BeginPlay()
|
|
|
|
{
|
|
|
|
Super::BeginPlay();
|
2020-12-01 18:30:41 +01:00
|
|
|
if(!TriggerVolume)
|
|
|
|
{
|
|
|
|
UE_LOG(LogTemp, Error, TEXT("No trigger volume found on: %s !"), *GetOwner()->GetName());
|
|
|
|
}
|
2020-12-01 11:32:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void UTriggerOpenDoor::TickComponent(float DeltaTime, ELevelTick TickType,
|
|
|
|
FActorComponentTickFunction* ThisTickFunction)
|
|
|
|
{
|
|
|
|
Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
|
2020-12-03 14:12:54 +01:00
|
|
|
|
2020-12-01 18:30:41 +01:00
|
|
|
if(!TriggerVolume)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-12-01 11:32:20 +01:00
|
|
|
TArray<AActor*> overlappingActors;
|
|
|
|
TriggerVolume->GetOverlappingActors(overlappingActors);
|
|
|
|
if (overlappingActors.Num() >= 1)
|
|
|
|
{
|
2020-12-08 12:21:49 +01:00
|
|
|
Rotate();
|
2020-12-01 11:32:20 +01:00
|
|
|
}
|
|
|
|
}
|