From 3160d68a46a647268b761d45ba7ffad5c2dcfa94 Mon Sep 17 00:00:00 2001 From: MostExcellent Date: Thu, 24 Oct 2024 15:58:35 -0700 Subject: [PATCH] Make VRPlayerController just use UVRAbilitySystemComponent --- .../Private/Player/VRPlayerController.cpp | 21 +++++++++++++------ .../VRGAS/Public/Player/VRPlayerController.h | 8 +++---- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/Plugins/VRGAS/Source/VRGAS/Private/Player/VRPlayerController.cpp b/Plugins/VRGAS/Source/VRGAS/Private/Player/VRPlayerController.cpp index 548d0c8..0ca5bb2 100644 --- a/Plugins/VRGAS/Source/VRGAS/Private/Player/VRPlayerController.cpp +++ b/Plugins/VRGAS/Source/VRGAS/Private/Player/VRPlayerController.cpp @@ -60,8 +60,22 @@ void AVRPlayerController::OnPossess(APawn* InPawn) UAbilitySystemGlobals::GetAbilitySystemComponentFromActor(GetPawn())); } -UAbilitySystemComponent* AVRPlayerController::GetAbilitySystemComponent() +// UAbilitySystemComponent* AVRPlayerController::GetAbilitySystemComponent() +// { +// if (!CachedAbilitySystemComponent.IsValid()) +// { +// CachedAbilitySystemComponent = Cast( +// UAbilitySystemGlobals::GetAbilitySystemComponentFromActor(GetPawn())); +// +// if (!CachedAbilitySystemComponent.IsValid()) return nullptr; +// } +// +// return CachedAbilitySystemComponent.Get(); +// } + +UVRAbilitySystemComponent* AVRPlayerController::GetVRAbilitySystemComponent() { + // return Cast(GetAbilitySystemComponent()); if (!CachedAbilitySystemComponent.IsValid()) { CachedAbilitySystemComponent = Cast( @@ -73,11 +87,6 @@ UAbilitySystemComponent* AVRPlayerController::GetAbilitySystemComponent() return CachedAbilitySystemComponent.Get(); } -UVRAbilitySystemComponent* AVRPlayerController::GetVRAbilitySystemComponent() -{ - return Cast(GetAbilitySystemComponent()); -} - void AVRPlayerController::Input_AbilityTagPressed(FGameplayTag InTag) { if (!GetVRAbilitySystemComponent()) diff --git a/Plugins/VRGAS/Source/VRGAS/Public/Player/VRPlayerController.h b/Plugins/VRGAS/Source/VRGAS/Public/Player/VRPlayerController.h index b8c0ccf..3246bfb 100644 --- a/Plugins/VRGAS/Source/VRGAS/Public/Player/VRPlayerController.h +++ b/Plugins/VRGAS/Source/VRGAS/Public/Player/VRPlayerController.h @@ -25,7 +25,7 @@ public: //~ Begin APlayerController Interface virtual void PostProcessInput(const float DeltaTime, const bool bGamePaused) override; - //~ End APlayerContoller Interface + //~ End APlayerController Interface protected: // TODO: Implement controller @@ -42,10 +42,10 @@ protected: #pragma region GAS UPROPERTY() - TWeakObjectPtr CachedAbilitySystemComponent; + TWeakObjectPtr CachedAbilitySystemComponent; - UFUNCTION(BlueprintPure, Category = "AbilitySystem", meta = (HideSelfPin)) - UAbilitySystemComponent* GetAbilitySystemComponent(); + // UFUNCTION(BlueprintPure, Category = "AbilitySystem", meta = (HideSelfPin)) + // UAbilitySystemComponent* GetAbilitySystemComponent(); UFUNCTION(BlueprintPure, Category = "AbilitySystem", meta = (HideSelfPin)) UVRAbilitySystemComponent* GetVRAbilitySystemComponent();