Bugfix Movement Not being Reenabled on Combat End

This commit is contained in:
Philip W 2022-11-29 00:33:34 +00:00
parent 1300c99a3f
commit fdfe4a660c
3 changed files with 19 additions and 3 deletions

Binary file not shown.

View File

@ -73,7 +73,7 @@ void UHoldToInitCombat::OnRightClickUp()
AActor* UHoldToInitCombat::LookingAtEnemy() const
{
FVector Start = GetOwner()->GetActorLocation();
FVector End = GetOwner()->GetActorForwardVector() * 3000.0f + Start;
FVector End = GetOwner()->GetActorForwardVector() * 1500.0f + Start;
FCollisionQueryParams CollisionParams;
CollisionParams.AddIgnoredActor(GetOwner());
if (FHitResult HitResult; GetWorld()->LineTraceSingleByChannel(HitResult, Start, End, ECC_Pawn, CollisionParams))

View File

@ -6,6 +6,7 @@
#include "Blueprint/UserWidget.h"
#include "Components/TextBlock.h"
#include "Components/ProgressBar.h"
#include "GameFramework/Character.h"
#include "Kismet/GameplayStatics.h"
// Sets default values
@ -32,6 +33,16 @@ void ATurnBaseCombatV2::StartCombat(AActor* Enemy)
PC->bEnableClickEvents = true;
PC->bEnableMouseOverEvents = true;
}
//Disable Character Movement
if (ACharacter* PlayerCharacter = Cast<ACharacter>(GetWorld()->GetFirstPlayerController()->GetPawn()))
{
PlayerCharacter->DisableInput(GetWorld()->GetFirstPlayerController());
}
CurrentComboString = "";
UpdateComboString(CurrentComboString);
RevertActionPoints();
UpdateActionPoints();
UpdateResourceBars();
}
void ATurnBaseCombatV2::EndCombat()
@ -41,6 +52,11 @@ void ATurnBaseCombatV2::EndCombat()
APawn* PlayerPawn = Cast<APawn>(GetWorld()->GetFirstPlayerController()->GetPawn());
PlayerPawn->bUseControllerRotationYaw = true;
PlayerPawn->bUseControllerRotationPitch = true;
//Enable Character Movement
if (ACharacter* PlayerCharacter = Cast<ACharacter>(GetWorld()->GetFirstPlayerController()->GetPawn()))
{
PlayerCharacter->EnableInput(GetWorld()->GetFirstPlayerController());
}
}
void ATurnBaseCombatV2::FKeyPressed()