23 UPROPERTY(BlueprintAssignable, Category =
"Door")
24 FOnDoorOpened OnDoorOpenedDelegate;
26 UFUNCTION(BlueprintCallable, Category="Interactable|
Door")
27 virtual
void OpenDoor(const
bool bOpen);
28 UFUNCTION(BlueprintCallable, Category="Interactable|
Door")
29 virtual
void DisableDoor(const
bool bDisable = true);
31 UFUNCTION(BlueprintCallable, Category="Interactable|
Door")
32 virtual
void SetStatusMaterial(UPrimitiveComponent* StatusComponent);
34 UFUNCTION(BlueprintPure, BlueprintCallable, Category="Interactable|
Door")
35 bool GetIsDoorOpen()
const {
return bDoorOpen;};
36 UFUNCTION(BlueprintPure, BlueprintCallable, Category=
"Interactable|Door")
37 bool GetIsDoorMoving()
const{
return bDoorMoving;};
40 UFUNCTION(BlueprintImplementableEvent, Category=
"Interactable|Door")
42 UFUNCTION(BlueprintImplementableEvent, Category="Interactable|
Door")
44 UFUNCTION(BlueprintImplementableEvent, Category="Interactable|
Door")
45 void OnDoorOpenedComplete();
46 UFUNCTION(BlueprintImplementableEvent, Category="Interactable|
Door")
47 void OnDoorClosedComplete();
48 UFUNCTION(BlueprintImplementableEvent, Category="Interactable|
Door")
49 void OnDoorLocked(const
bool bValue);
51 UFUNCTION(BlueprintCallable, Category="Interactable|
Door")
52 void SetDoorLocked(const
bool bValue);
53 UFUNCTION(BlueprintCallable, Category="Interactable|
Door")
54 bool GetIsDoorLocked()
const{
return bLocked;};
57 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category=
"Door")
61 virtual
void BeginPlay() override;
62 virtual
void OnConstruction(const FTransform& Transform) override;
63 virtual
void ReceiveOnInteract(AActor* Caller, const
EInteractionType InteractionType) override;
64 virtual
void ReceiveToggleSwitch(AActor* Caller, const
bool bOn) override;
69 virtual
void OpenDoorInstantly();
70 virtual
void OpenDoorInstantly(const
bool bOpen);
73 UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category="
Door|Components")
74 USceneComponent* RootSceneComponent;
75 UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category="
Door|Components")
76 UStaticMeshComponent* MainDoorComponent;
79 UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category="
Door|Components")
80 class UBoxComponent* BoxComponent;
84 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="
Door|
General")
85 bool bHasSwitch = false;
86 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="
Door|
General")
87 bool bIsAutomatic = true;
88 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="
Door|
General")
89 bool bStartOpen = false;
90 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="
Door|Material")
91 UMaterialInstance* StatusMaterial =
nullptr;
92 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="
Door|Material")
93 UMaterialInstanceDynamic* DynamicMaterial =
nullptr;
94 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="
Door|Material")
95 FLinearColor LockedColor = FLinearColor::Red;
96 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="
Door|Material")
97 FLinearColor UnlockedColor = FLinearColor::Green;
98 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="
Door|Material")
99 FLinearColor BrokenColor = FLinearColor::Yellow;
100 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="
Door|Material")
101 FName MaterialParamName = "Color";
103 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="
Door|Animation")
104 bool bEaseIn = false;
105 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="
Door|Animation")
106 bool bEaseOut = false;
108 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="
Door|Animation")
109 float TimeToOpen = 1.0f;
111 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="
Door|Sound")
112 USoundBase* DoorOpenSound =
nullptr;
113 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="
Door|Sound")
114 bool bPlayingSound = false;
116 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="
Door|
Lock")
117 bool bLockable = false;
118 UPROPERTY(ReplicatedUsing=OnLockedReplicated, EditAnywhere, BlueprintReadWrite, Category="
Door|
Lock", meta=(EditCondition="bLockable"))
119 bool bLocked = false;
122 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="
Door|
Location")
123 FVector TargetLocation;
124 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="
Door|
Location")
125 FRotator TargetRotation;
128 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="
Door|State")
129 bool bDoorBroken = false;
130 UPROPERTY(ReplicatedUsing=OnDoorOpenReplicated, VisibleAnywhere, BlueprintReadOnly, Category="
Door|State")
131 bool bDoorOpen = false;
132 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="
Door|State")
133 bool bDoorMoving = false;
135 void OnDoorOpenReplicated();
137 void OnLockedReplicated();
141 void OnBoxBeginOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComponent, int32 OtherBodyIndex,
bool bFromSweep, const FHitResult& HitResult);
143 void OnBoxEndOverlap(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComponent, int32 OtherBodyIndex);
146 void OnMainDoorOpened();
148 void OnMainDoorClosed();
150 void CloseMainDoor();
152 void MoveDoor(const
bool bOpen);
154 FLinearColor GetStatusColor() const;
155 void UpdateStatusMaterial() const;
157 UPROPERTY(Replicated, VisibleAnywhere, Category="
Door|
Location")
158 FVector MainDoorStartLocation;
159 UPROPERTY(Replicated, VisibleAnywhere, Category="
Door|
Location")
160 FRotator MainDoorStartRotation;
163 FTimerHandle RetryMainDoorOpen;
164 FTimerHandle RetryMainDoorClose;