Setup for character
movement not working
This commit is contained in:
57
Source/OpenConflict/PlayerCharacter/DDIPlayerController.cpp
Normal file
57
Source/OpenConflict/PlayerCharacter/DDIPlayerController.cpp
Normal file
@@ -0,0 +1,57 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "DDIPlayerController.h"
|
||||
#include "EnhancedInputSubsystems.h"
|
||||
#include "Engine/LocalPlayer.h"
|
||||
#include "InputMappingContext.h"
|
||||
#include "DDICameraManager.h"
|
||||
#include "DDICharacter.h"
|
||||
// #include "UI/DDIWeaponUI.h"
|
||||
|
||||
ADDIPlayerController::ADDIPlayerController()
|
||||
{
|
||||
PlayerCameraManagerClass = ADDICameraManager::StaticClass();
|
||||
}
|
||||
|
||||
void ADDIPlayerController::SetupInputComponent()
|
||||
{
|
||||
Super::SetupInputComponent();
|
||||
|
||||
if (UEnhancedInputLocalPlayerSubsystem* Subsystem = ULocalPlayer::GetSubsystem<UEnhancedInputLocalPlayerSubsystem>(GetLocalPlayer()))
|
||||
{
|
||||
for (UInputMappingContext* CurrentContext : DefaultMappingContexts)
|
||||
{
|
||||
Subsystem->AddMappingContext(CurrentContext, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ADDIPlayerController::BeginPlay()
|
||||
{
|
||||
Super::BeginPlay();
|
||||
|
||||
// WeaponUI = CreateWidget<UDDIWeaponUI>(this, WeaponUIClass);
|
||||
// WeaponUI->AddToPlayerScreen(0);
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
// subscribe to the pawn's bullet count updated delegate
|
||||
// DDICharacter->OnBulletCountUpdated.AddDynamic(this, &ADDIPlayerController::OnBulletCountUpdated);
|
||||
}
|
||||
}
|
||||
|
||||
// void ADDIPlayerController::OnBulletCountUpdated(int MagazineSize, int Bullets)
|
||||
// {
|
||||
// // update the UI
|
||||
// // WeaponUI->BP_UpdateBulletCounter(MagazineSize, Bullets);
|
||||
// }
|
||||
Reference in New Issue
Block a user