feat: initial commit
This commit is contained in:
		
							
								
								
									
										68
									
								
								Source/UTAD_UI/UTAD_UIPlayerController.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										68
									
								
								Source/UTAD_UI/UTAD_UIPlayerController.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,68 @@ | ||||
| // 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(); | ||||
|  | ||||
| 	/** 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; | ||||
|  | ||||
| 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(); | ||||
|  | ||||
| private: | ||||
| 	FVector CachedDestination; | ||||
|  | ||||
| 	bool bIsTouch; // Is it a touch device | ||||
| 	float FollowTime; // For how long it has been pressed | ||||
| }; | ||||
|  | ||||
|  | ||||
		Reference in New Issue
	
	Block a user