45 lines
886 B
C++
45 lines
886 B
C++
// Tyrel Souza 2018
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "Components/ActorComponent.h"
|
|
#include "Engine/TriggerVolume.h"
|
|
|
|
#include "OpenDoor.generated.h"
|
|
|
|
|
|
UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
|
|
class ROOMESCAPE_API UOpenDoor : public UActorComponent
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
// Sets default values for this component's properties
|
|
UOpenDoor();
|
|
void OpenDoor();
|
|
void CloseDoor();
|
|
virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
|
|
|
|
protected:
|
|
// Called when the game starts
|
|
virtual void BeginPlay() override;
|
|
|
|
private:
|
|
UPROPERTY(EditAnywhere)
|
|
float OpenAngle = -90.f;
|
|
|
|
UPROPERTY(EditAnywhere)
|
|
ATriggerVolume* PressurePlate;
|
|
|
|
UPROPERTY(EditAnywhere)
|
|
float DoorCloseDelay = 1.f;
|
|
|
|
float LastDoorOpenTime;
|
|
|
|
AActor* ActorThatOpens;
|
|
AActor* OwningDoor;
|
|
|
|
|
|
};
|