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"