40 lines
915 B
C++
40 lines
915 B
C++
// Fill out your copyright notice in the Description page of Project Settings.
|
|
|
|
|
|
#include "DDIPlayerController.h"
|
|
|
|
#include "DDICharacter.h"
|
|
#include "EnhancedInputSubsystems.h"
|
|
#include "Engine/LocalPlayer.h"
|
|
#include "InputMappingContext.h"
|
|
|
|
void ADDIPlayerController::BeginPlay()
|
|
{
|
|
Super::BeginPlay();
|
|
|
|
if (UEnhancedInputLocalPlayerSubsystem* Subsystem = ULocalPlayer::GetSubsystem<UEnhancedInputLocalPlayerSubsystem>(GetLocalPlayer()))
|
|
{
|
|
for (UInputMappingContext* CurrentContext : MappingContexts)
|
|
{
|
|
Subsystem->AddMappingContext(CurrentContext, 0);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
void ADDIPlayerController::SetupInputComponent()
|
|
{
|
|
// Super::SetupInputComponent();
|
|
}
|
|
|
|
void ADDIPlayerController::OnPossess(APawn* InPawn)
|
|
{
|
|
Super::OnPossess(InPawn);
|
|
|
|
// is this a shooter character?
|
|
if (ADDICharacter* DDICharacter = Cast<ADDICharacter>(InPawn))
|
|
{
|
|
// add the player tag
|
|
DDICharacter->Tags.Add(PlayerPawnTag);
|
|
}
|
|
} |