From 957da3946aa142ace543585c6e0c90eb87b85e0b Mon Sep 17 00:00:00 2001 From: baz Date: Thu, 1 Feb 2024 00:53:01 +0000 Subject: [PATCH] Create GetCrouched method in PlayerCharacter --- Source/Nakatomi/PlayerCharacter.cpp | 10 ++++++++++ Source/Nakatomi/PlayerCharacter.h | 3 +++ 2 files changed, 13 insertions(+) diff --git a/Source/Nakatomi/PlayerCharacter.cpp b/Source/Nakatomi/PlayerCharacter.cpp index 8e892ea..a73b591 100644 --- a/Source/Nakatomi/PlayerCharacter.cpp +++ b/Source/Nakatomi/PlayerCharacter.cpp @@ -759,3 +759,13 @@ bool APlayerCharacter::GetPressedJump() { return jumpPressed; } + +bool APlayerCharacter::GetCrouched() +{ + if (UNakatomiCMC* cmc = GetCharacterMovementComponent()) + { + return cmc->IsCrouching(); + } + + return false; +} diff --git a/Source/Nakatomi/PlayerCharacter.h b/Source/Nakatomi/PlayerCharacter.h index 5d7a1c1..76e941e 100644 --- a/Source/Nakatomi/PlayerCharacter.h +++ b/Source/Nakatomi/PlayerCharacter.h @@ -221,6 +221,9 @@ public: UFUNCTION(BlueprintCallable) bool GetPressedJump(); + UFUNCTION(BlueprintCallable) + bool GetCrouched(); + protected: virtual void CalculateHits(TArray* hits) override;