From 264db39cc1652a69cd2c834d0fd6ef8455ff7f2c Mon Sep 17 00:00:00 2001 From: Ji Yoon Rhee Date: Sun, 9 Jun 2024 22:25:09 +0900 Subject: [PATCH] included the input mapping contexts to character.cpp and playercharaccontroller.cpp. need to replace the interact to character --- .../Source/hwanyoung2/HYPlayerCharacController.cpp | 13 ++++++++++--- .../Source/hwanyoung2/HYPlayerCharacController.h | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/hwanyoung2/Source/hwanyoung2/HYPlayerCharacController.cpp b/hwanyoung2/Source/hwanyoung2/HYPlayerCharacController.cpp index 76ae7035..20779101 100644 --- a/hwanyoung2/Source/hwanyoung2/HYPlayerCharacController.cpp +++ b/hwanyoung2/Source/hwanyoung2/HYPlayerCharacController.cpp @@ -4,6 +4,7 @@ #include "HYPlayerCharacController.h" #include "HYGameStateBase.h" #include "hwanyoung2Character.h" +#include "EnhancedInputComponent.h" AHYPlayerCharacController::AHYPlayerCharacController() { @@ -48,9 +49,15 @@ void AHYPlayerCharacController::SetupInputComponent() { Super::SetupInputComponent(); - InputComponent->BindAction( - "Interact", IE_Pressed, this, - &AHYPlayerCharacController::Interact); + if (UEnhancedInputComponent* EnhancedInputComponent = CastChecked(InputComponent)) { + EnhancedInputComponent->BindAction( + InteractAction, ETriggerEvent::Triggered, + this, &AHYPlayerCharacController::Interact); + EnhancedInputComponent->BindAction( + ToggleInventoryAction, ETriggerEvent::Triggered, + this, &AHYPlayerCharacController::ReloadInventory); + + } } void AHYPlayerCharacController::OnPossess(APawn* InPawn) diff --git a/hwanyoung2/Source/hwanyoung2/HYPlayerCharacController.h b/hwanyoung2/Source/hwanyoung2/HYPlayerCharacController.h index dd31736b..3e16c974 100644 --- a/hwanyoung2/Source/hwanyoung2/HYPlayerCharacController.h +++ b/hwanyoung2/Source/hwanyoung2/HYPlayerCharacController.h @@ -4,7 +4,7 @@ #include "HYInteractableActor.h" #include "InventoryItem.h" - +#include "InputAction.h" #include "CoreMinimal.h" #include "GameFramework/PlayerController.h" #include "HYPlayerCharacController.generated.h"