LEAP Documentation 40220
Documentation for the LEAP project
Door.h
Go to the documentation of this file.
1// Copyright Blue Isle Studios Inc 2018. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
7#include "Engine/EngineTypes.h"
8#include "Kismet/KismetMathLibrary.h"
9#include "Door.generated.h"
10
11UENUM(BlueprintType)
12enum class EDoorState : uint8
13{
14 Closed = 0,
15 OpenInwards = 1,
16 OpenOutwards = 2,
17};
18
19class UPrimitiveComponent;
20
21UCLASS()
22class PROJECTX_API ADoor : public AManagedStateActor
23{
24 GENERATED_BODY()
25
26private:
27 bool bIsInside;
28
29 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Components", meta = (AllowPrivateAccess = true))
30 class UStaticMeshComponent* DoorMesh;
31 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Components", meta = (AllowPrivateAccess = true))
32 class UBoxComponent* Inside;
33 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Components", meta = (AllowPrivateAccess = true))
34 class UBoxComponent* DoorCollisionAndNavigationBlocker;
35 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Components", meta = (AllowPrivateAccess = true))
36 class UBoxComponent* Outside;
37 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Components", meta = (AllowPrivateAccess = true))
38 class USceneComponent* DoorHinge;
39 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Components", meta = (AllowPrivateAccess = true))
40 class USceneComponent* DoorRoot;
41 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Components", meta = (AllowPrivateAccess = true))
42 class UInteractableComponent* Interactable;
43
44 ADoor();
45
46 UFUNCTION()
47 void OnSelected(APlayerController* Sender, class UPrimitiveComponent* Component);
48 UFUNCTION()
49 void OnInsideOfDoor(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult);
50 UFUNCTION()
51 void OnOutsideOfDoor(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult);
52
53protected:
54 virtual void BeginPlay() override;
55 virtual void SetState(AController* Sender, const uint8 NewState, bool bIsFromInit = false);
56
57public:
58 /* Tooltip to display when the door is open */
59 UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Door Config")
60 FText OpenDoorText = NSLOCTEXT("ProjectX", "cmd_opendoor", "Open Door");
61 /* Tooltip to display when the door is closed */
62 UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Door Config")
63 FText CloseDoorText = NSLOCTEXT("ProjectX", "cmd_closedir", "Close Door");
64 /* Direction to open the door when the player is standing in the "outside" volume */
65 UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Door Config")
66 float InsideDegreesOpen = 90.0f;
67 /* Direction to open the door when the player is standing in the "inside" volume */
68 UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Door Config")
69 float OutsideDegreesOpen = -90.0f;
70 /* What should the door's initial state be? */
71 UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Door Config")
72 EDoorState InitialState = EDoorState::Closed;
73 /* What curve to use when playing a door open/close animation */
74 UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Door Config")
75 TEnumAsByte<EEasingFunc::Type> DoorAnimationEaseType;
76 /* Time taken to open/close the door */
77 UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Door Config")
78 float DoorOpenInterpolationTime = 0.25f;
79
80 virtual uint8 GetStateCount() const override;
81
82 UFUNCTION(BlueprintCallable, Category = "State Functions")
83 void AnimateDoor(const float InterpDegrees, const bool bIsFromInit = false);
84};
@ Close
Definition: AdvancedUserWidget.h:25
@ Open
Definition: AdvancedUserWidget.h:24
EDoorState
Definition: Door.h:13
Definition: Door.h:23
Definition: ManagedStateActor.h:21
Definition: ProjectX.Build.cs:6