A Demo Project for the UnrealEngineSDK
|
Represents an interaction button actor. More...
#include <InteractionButton.h>
Public Member Functions | |
AInteractionButton () | |
EButtonState | GetButtonState () const |
Gets the current state of the button. | |
virtual void | GetLifetimeReplicatedProps (TArray< FLifetimeProperty > &OutLifetimeProps) const override |
FButtonPressedDelegate & | OnButtonPressed () |
Retrieves the button pressed delegate. | |
FButtonReleasedDelegate & | OnButtonReleased () |
Retrieves the button released delegate. | |
void | SetButtonName (const FName &InButtonName) |
Sets the name of the button (will be displayed on TextRenderComp). | |
void | SetButtonState (EButtonState InButtonState) |
Sets the state of the button. | |
void | SetButtonVisibility (bool bVisible) |
Sets the visibility of the button. | |
virtual void | Tick (float DeltaTime) override |
Public Attributes | |
FButtonPressedDelegate | ButtonPressedDelegate |
UPROPERTY(BlueprintAssignable) | |
FButtonReleasedDelegate | ButtonReleasedDelegate |
UPROPERTY(BlueprintAssignable) | |
Protected Member Functions | |
virtual void | BeginPlay () override |
void | ButtonPress () |
Event called when button was pressed. Overload it when you want to add functionality. | |
void | ButtonRelease () |
Event called when button was released. Overload it when you want to add functionality. | |
Protected Attributes | |
bool | bIsButtonHaveText = false |
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Setup) | |
UBoxComponent * | BoxCollisionComp |
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = Components) | |
UStaticMeshComponent * | ButtonMovingComp |
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = Components) | |
USoundBase * | ButtonPressSound |
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Setup) | |
UStaticMeshComponent * | ButtonSupportComp |
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = Components) | |
FName | ButtonText = "Button Text" |
UPROPERTY(Replicated, EditAnywhere, BlueprintReadOnly, Category = Setup, meta = (EditCondition = "bIsButtonHaveText = true", EditConditionHides)) | |
UForceFeedbackEffect * | LeftHandFeedbackEffect |
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Setup) | |
UCurveFloat * | MovingButtonCurve |
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Setup) | |
UPointLightComponent * | PointLightComp |
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = Components) | |
UForceFeedbackEffect * | RightHandFeedbackEffect |
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Setup) | |
UTextRenderComponent * | TextRenderComp |
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = Components) | |
Private Member Functions | |
GENERATED_BODY () | |
void | MovingButtonTimelineFinished () |
Event handler for the finished state of the moving button timeline. | |
void | MovingButtonTimelineProgress (float Value) |
Event handler for the progress of the moving button timeline. | |
void | OnBeginOverlapButton (UPrimitiveComponent *OverlappedComponent, AActor *OtherActor, UPrimitiveComponent *OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult &SweepResult) |
UFUNCTION() | |
Private Attributes | |
bool | bIsPressed = false |
Indicates whether the button is currently pressed. | |
EButtonState | CurrentButtonState = EButtonState::BS_Default |
The current state of the button. | |
FTimeline | MovingButtonTimeLine |
Timeline for the movement of the button. | |
APlayerController * | PlayerController |
UPROPERTY() | |
TEnumAsByte< ETimelineDirection::Type > | TimelineDirection |
UPROPERTY() | |
Represents an interaction button actor.
UCLASS(Blueprintable)
Definition at line 38 of file InteractionButton.h.
AInteractionButton::AInteractionButton | ( | ) |
|
overrideprotectedvirtual |
Definition at line 117 of file InteractionButton.cpp.
|
protectedBlueprintNativeEvent |
Event called when button was pressed. Overload it when you want to add functionality.
UFUNCTION(BlueprintNativeEvent)
|
protectedBlueprintNativeEvent |
Event called when button was released. Overload it when you want to add functionality.
UFUNCTION(BlueprintNativeEvent)
|
private |
|
inlineBlueprintCallableBlueprintPure |
Gets the current state of the button.
UFUNCTION(BlueprintCallable, BlueprintPure)
Definition at line 72 of file InteractionButton.h.
|
overridevirtual |
Definition at line 110 of file InteractionButton.cpp.
|
private |
Event handler for the finished state of the moving button timeline.
UFUNCTION()
Definition at line 195 of file InteractionButton.cpp.
|
private |
Event handler for the progress of the moving button timeline.
Value | The current value of the timeline. |
UFUNCTION()
Definition at line 189 of file InteractionButton.cpp.
|
private |
UFUNCTION()
Definition at line 157 of file InteractionButton.cpp.
|
inline |
Retrieves the button pressed delegate.
Definition at line 56 of file InteractionButton.h.
|
inline |
Retrieves the button released delegate.
Definition at line 61 of file InteractionButton.h.
|
BlueprintCallable |
Sets the name of the button (will be displayed on TextRenderComp).
InButtonName | The name of the button. |
UFUNCTION(BlueprintCallable)
Definition at line 102 of file InteractionButton.cpp.
|
BlueprintCallable |
Sets the state of the button.
InButtonState | The button state to set. |
UFUNCTION(BlueprintCallable)
Definition at line 77 of file InteractionButton.cpp.
void AInteractionButton::SetButtonVisibility | ( | bool | bVisible | ) |
Sets the visibility of the button.
bVisible | The visibility state of the button. |
Definition at line 66 of file InteractionButton.cpp.
|
overridevirtual |
Definition at line 59 of file InteractionButton.cpp.
|
protectedBlueprintReadOnlyEditAnywhere |
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Setup)
Determines whether the button should show text.
Definition at line 186 of file InteractionButton.h.
|
private |
Indicates whether the button is currently pressed.
Definition at line 220 of file InteractionButton.h.
|
protectedBlueprintReadWriteVisibleAnywhere |
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = Components)
Component for collision detection of the button.
Definition at line 167 of file InteractionButton.h.
|
protectedBlueprintReadWriteVisibleAnywhere |
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = Components)
Button itself. It will be moving when pressed.
Definition at line 161 of file InteractionButton.h.
|
BlueprintAssignable |
UPROPERTY(BlueprintAssignable)
Delegate for button pressed event.
Definition at line 99 of file InteractionButton.h.
|
protectedBlueprintReadOnlyEditAnywhere |
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Setup)
Sound played when the button is pressed.
Definition at line 199 of file InteractionButton.h.
|
BlueprintAssignable |
UPROPERTY(BlueprintAssignable)
Delegate for button released event.
Definition at line 104 of file InteractionButton.h.
|
protectedBlueprintReadWriteVisibleAnywhere |
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = Components)
Button base mesh.
Definition at line 155 of file InteractionButton.h.
|
protectedBlueprintReadOnlyEditAnywhereReplicated |
UPROPERTY(Replicated, EditAnywhere, BlueprintReadOnly, Category = Setup, meta = (EditCondition = "bIsButtonHaveText = true", EditConditionHides))
The text displayed on the TextRenderComp.
Definition at line 193 of file InteractionButton.h.
|
private |
The current state of the button.
Definition at line 221 of file InteractionButton.h.
|
protectedBlueprintReadOnlyEditAnywhere |
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Setup)
Feedback effect played in the left hand when interacting with the button.
Definition at line 211 of file InteractionButton.h.
|
protectedBlueprintReadOnlyEditAnywhere |
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Setup)
Curve defining the movement of the button.
Definition at line 205 of file InteractionButton.h.
|
private |
Timeline for the movement of the button.
Definition at line 223 of file InteractionButton.h.
|
private |
UPROPERTY()
The player controller associated with the button.
Definition at line 232 of file InteractionButton.h.
|
protectedBlueprintReadWriteVisibleAnywhere |
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = Components)
Component for the point light of the button.
Definition at line 173 of file InteractionButton.h.
|
protectedBlueprintReadOnlyEditAnywhere |
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Setup)
Feedback effect played in the right hand when interacting with the button.
Definition at line 217 of file InteractionButton.h.
|
protectedBlueprintReadWriteVisibleAnywhere |
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = Components)
Component for rendering the text for the button.
Definition at line 179 of file InteractionButton.h.
|
private |