document.write("
// Copyright Epic Games, Inc. All Rights Reserved.
#include "DandelionPlayerController.h"
#include "EnhancedInputSubsystems.h"
#include "Engine/LocalPlayer.h"
#include "Engine/World.h"
#include "GameFramework/Pawn.h"
#include "Navigation/PathFollowingComponent.h"
DEFINE_LOG_CATEGORY(LogTemplateCharacter);
ADandelionPlayerController::ADandelionPlayerController()
{
bShowMouseCursor = true;
DefaultMouseCursor = EMouseCursor::Default;
PathFollowingComponent = CreateDefaultSubobject<UPathFollowingComponent>(TEXT("PathFollowingComponent"));
}
void ADandelionPlayerController::OnPossess(APawn* InPawn)
{
Super::OnPossess(InPawn);
PathFollowingComponent->Initialize();
}
void ADandelionPlayerController::StopMovement()
{
APawn* PlayerPawn = GetPawn();
if (IsValid(PlayerPawn)) { PlayerPawn->ConsumeMovementInputVector(); }
Super::StopMovement();
}
void ADandelionPlayerController::SetupInputComponent()
{
Super::SetupInputComponent();
UEnhancedInputLocalPlayerSubsystem* Subsystem =
ULocalPlayer::GetSubsystem<UEnhancedInputLocalPlayerSubsystem>(GetLocalPlayer());
if (!ensure(IsValid(Subsystem)))
{
UE_LOG(
LogTemplateCharacter,
Error,
TEXT("%s: Attempted to SetupInputComponent with an invalid UEnhancedInputLocalPlayerSubsystem"),
*GetFullNameSafe(this)
);
return;
}
for (const UInputMappingContext* MappingContext : DefaultInputMappingContexts)
{
Subsystem->AddMappingContext(MappingContext, 0);
}
}
DandelionPlayerController.cpp - Snippet hosted by \"Cacher\"
");