Merge remote-tracking branch 'origin/main' into fmod-integration

This commit is contained in:
benroshio 2024-06-09 16:20:22 -04:00
commit d4fbc87b5a
31 changed files with 73 additions and 42 deletions

View File

@ -4,6 +4,7 @@
#include "HYPlayerCharacController.h" #include "HYPlayerCharacController.h"
#include "HYGameStateBase.h" #include "HYGameStateBase.h"
#include "hwanyoung2Character.h" #include "hwanyoung2Character.h"
#include "EnhancedInputComponent.h"
AHYPlayerCharacController::AHYPlayerCharacController() AHYPlayerCharacController::AHYPlayerCharacController()
{ {
@ -48,9 +49,15 @@ void AHYPlayerCharacController::SetupInputComponent()
{ {
Super::SetupInputComponent(); Super::SetupInputComponent();
InputComponent->BindAction( if (UEnhancedInputComponent* EnhancedInputComponent = CastChecked<UEnhancedInputComponent>(InputComponent)) {
"Interact", IE_Pressed, this, EnhancedInputComponent->BindAction(
&AHYPlayerCharacController::Interact); InteractAction, ETriggerEvent::Triggered,
this, &AHYPlayerCharacController::Interact);
EnhancedInputComponent->BindAction(
ToggleInventoryAction, ETriggerEvent::Triggered,
this, &AHYPlayerCharacController::ReloadInventory);
}
} }
void AHYPlayerCharacController::OnPossess(APawn* InPawn) void AHYPlayerCharacController::OnPossess(APawn* InPawn)

View File

@ -4,7 +4,7 @@
#include "HYInteractableActor.h" #include "HYInteractableActor.h"
#include "InventoryItem.h" #include "InventoryItem.h"
#include "InputAction.h"
#include "CoreMinimal.h" #include "CoreMinimal.h"
#include "GameFramework/PlayerController.h" #include "GameFramework/PlayerController.h"
#include "HYPlayerCharacController.generated.h" #include "HYPlayerCharacController.generated.h"
@ -44,6 +44,10 @@ public:
UPROPERTY(EditAnywhere, BlueprintReadWrite) UPROPERTY(EditAnywhere, BlueprintReadWrite)
int32 InventoryWeightLimit; int32 InventoryWeightLimit;
/** MappingContext */
UPROPERTY(EditAnywhere, Category = Input, meta = (AllowPrivateAccess = "true"))
class UInputMappingContext* InputMapping;
/** Toggle inventory GUI Input Action */ /** Toggle inventory GUI Input Action */
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = "true")) UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = "true"))
class UInputAction* ToggleInventoryAction; class UInputAction* ToggleInventoryAction;

View File

@ -50,9 +50,11 @@ void Ahwanyoung2Character::BeginPlay()
{ {
if (UEnhancedInputLocalPlayerSubsystem* Subsystem = ULocalPlayer::GetSubsystem<UEnhancedInputLocalPlayerSubsystem>(PlayerController->GetLocalPlayer())) if (UEnhancedInputLocalPlayerSubsystem* Subsystem = ULocalPlayer::GetSubsystem<UEnhancedInputLocalPlayerSubsystem>(PlayerController->GetLocalPlayer()))
{ {
Subsystem->AddMappingContext(DefaultMappingContext, 0); Subsystem->AddMappingContext(InputMapping, 0);
} }
} }
} }
void Ahwanyoung2Character::CheckForInteractables() void Ahwanyoung2Character::CheckForInteractables()

View File

@ -4,7 +4,7 @@
#include "CoreMinimal.h" #include "CoreMinimal.h"
#include "GameFramework/Character.h" #include "GameFramework/Character.h"
#include "InputActionValue.h" #include "InputAction.h"
#include "hwanyoung2.h" #include "hwanyoung2.h"
#include "hwanyoung2Character.generated.h" #include "hwanyoung2Character.generated.h"
@ -28,8 +28,8 @@ class Ahwanyoung2Character : public ACharacter
#pragma region Character Gameplay Input Action #pragma region Character Gameplay Input Action
/** MappingContext */ /** MappingContext */
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = "true")) UPROPERTY(EditAnywhere, Category = Input, meta = (AllowPrivateAccess = "true"))
class UInputMappingContext* DefaultMappingContext; class UInputMappingContext* InputMapping;
/** Jump Input Action */ /** Jump Input Action */
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = "true")) UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = "true"))