// Copyright Epic Games, Inc. All Rights Reserved. #pragma once #include "CoreMinimal.h" #include "Templates/SubclassOf.h" #include "GameFramework/PlayerController.h" #include "UTAD_UIPlayerController.generated.h" /** Forward declaration to improve compiling times */ class UNiagaraSystem; class UInputMappingContext; class UInputAction; DECLARE_LOG_CATEGORY_EXTERN(LogTemplateCharacter, Log, All); UCLASS() class AUTAD_UIPlayerController : public APlayerController { GENERATED_BODY() public: AUTAD_UIPlayerController(); // UI Management UFUNCTION(BlueprintCallable, Category = "UI") void ShowMainHUD(); UFUNCTION(BlueprintCallable, Category = "UI") void ShowSkillTree(); UFUNCTION(BlueprintCallable, Category = "UI") void HideSkillTree(); UFUNCTION(BlueprintCallable, Category = "UI") void ToggleSkillTree(); /** Time Threshold to know if it was a short press */ UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input) float ShortPressThreshold; /** FX Class that we will spawn when clicking */ UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input) UNiagaraSystem* FXCursor; /** MappingContext */ UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = "true")) UInputMappingContext* DefaultMappingContext; /** Jump Input Action */ UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = "true")) UInputAction* SetDestinationClickAction; /** Jump Input Action */ UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = "true")) UInputAction* SetDestinationTouchAction; /** Open Skill Tree Input Action */ UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = "true")) UInputAction* OpenSkillTreeAction; protected: /** True if the controlled character should navigate to the mouse cursor. */ uint32 bMoveToMouseCursor : 1; virtual void SetupInputComponent() override; // To add mapping context virtual void BeginPlay(); /** Input handlers for SetDestination action. */ void OnInputStarted(); void OnSetDestinationTriggered(); void OnSetDestinationReleased(); void OnTouchTriggered(); void OnTouchReleased(); /** Input handler for opening skill tree */ void OnOpenSkillTree(); // Widget Classes UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "UI") TSubclassOf MainHUDClass; UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "UI") TSubclassOf SkillTreeWidgetClass; // Widget Instances UPROPERTY() class UUserWidget* MainHUDWidget; UPROPERTY() class UUserWidget* SkillTreeWidget; private: FVector CachedDestination; bool bIsTouch; // Is it a touch device float FollowTime; // For how long it has been pressed };