Bugfix Initiating Combat with the Inventory Open Blocks Input
This commit is contained in:
parent
14f4ff4d35
commit
5104a21b2f
@ -48,8 +48,6 @@ void ATurnBaseCombatV2::StartCombat(AActor* Enemy, const bool bWasShot)
|
|||||||
EnemyActor = Enemy;
|
EnemyActor = Enemy;
|
||||||
StatusTextBlock->SetRenderOpacity(0.0f);
|
StatusTextBlock->SetRenderOpacity(0.0f);
|
||||||
BookHUD->SetVisibility(ESlateVisibility::SelfHitTestInvisible);
|
BookHUD->SetVisibility(ESlateVisibility::SelfHitTestInvisible);
|
||||||
Cast<ATempCharacter>(PlayerActor)->InventoryWidget->SetVisibility(ESlateVisibility::Hidden);
|
|
||||||
Cast<ATempCharacter>(PlayerActor)->EscapeMenuWidget->SetVisibility(ESlateVisibility::Hidden);
|
|
||||||
HUD->AddToViewport(-1);
|
HUD->AddToViewport(-1);
|
||||||
BookStaticMeshComponent->SetVisibility(true);
|
BookStaticMeshComponent->SetVisibility(true);
|
||||||
EscapePercentage = CalculateEscapePercentage();
|
EscapePercentage = CalculateEscapePercentage();
|
||||||
@ -59,6 +57,12 @@ void ATurnBaseCombatV2::StartCombat(AActor* Enemy, const bool bWasShot)
|
|||||||
Cast<UQuestSystem>(PlayerActor->GetComponentByClass(UQuestSystem::StaticClass()))->QuestWidgetInstance->SetVisibility(ESlateVisibility::Hidden);
|
Cast<UQuestSystem>(PlayerActor->GetComponentByClass(UQuestSystem::StaticClass()))->QuestWidgetInstance->SetVisibility(ESlateVisibility::Hidden);
|
||||||
HealingJellyAmountTextBlock->SetText(FText::FromString(FString::FromInt(FMath::Clamp(Cast<ATempCharacter>(PlayerActor)->Inventory->GetItemAmount(0), 0, 99))));
|
HealingJellyAmountTextBlock->SetText(FText::FromString(FString::FromInt(FMath::Clamp(Cast<ATempCharacter>(PlayerActor)->Inventory->GetItemAmount(0), 0, 99))));
|
||||||
|
|
||||||
|
FOutputDeviceNull AR;
|
||||||
|
const FString Command = FString::Printf(TEXT("CloseInventory"));
|
||||||
|
PlayerActor->CallFunctionByNameWithArguments(*Command, AR, nullptr, true);
|
||||||
|
const FString Command69 = FString::Printf(TEXT("CloseEscapeMenu"));
|
||||||
|
PlayerActor->CallFunctionByNameWithArguments(*Command69, AR, nullptr, true);
|
||||||
|
|
||||||
//Disable Character Movement
|
//Disable Character Movement
|
||||||
APlayerController* PlayerController = GetWorld()->GetFirstPlayerController();
|
APlayerController* PlayerController = GetWorld()->GetFirstPlayerController();
|
||||||
PlayerController->SetIgnoreMoveInput(true);
|
PlayerController->SetIgnoreMoveInput(true);
|
||||||
@ -75,9 +79,8 @@ void ATurnBaseCombatV2::StartCombat(AActor* Enemy, const bool bWasShot)
|
|||||||
FProperty* IsBossProperty = FindFieldChecked<FProperty>(EnemyActor->GetClass(), "IsBoss");
|
FProperty* IsBossProperty = FindFieldChecked<FProperty>(EnemyActor->GetClass(), "IsBoss");
|
||||||
if (const FBoolProperty* IsBossBoolProperty = CastFieldChecked<FBoolProperty>(IsBossProperty); IsBossBoolProperty->GetPropertyValue_InContainer(EnemyActor))
|
if (const FBoolProperty* IsBossBoolProperty = CastFieldChecked<FBoolProperty>(IsBossProperty); IsBossBoolProperty->GetPropertyValue_InContainer(EnemyActor))
|
||||||
{
|
{
|
||||||
FOutputDeviceNull AR;
|
const FString Command123 = FString::Printf(TEXT("TriggerCombatAnimation true"));
|
||||||
const FString Command = FString::Printf(TEXT("TriggerCombatAnimation true"));
|
EnemyActor->CallFunctionByNameWithArguments(*Command123, AR, nullptr, true);
|
||||||
EnemyActor->CallFunctionByNameWithArguments(*Command, AR, nullptr, true);
|
|
||||||
FVector Direction = EnemyActor->GetActorLocation() - PlayerActor->GetActorLocation();
|
FVector Direction = EnemyActor->GetActorLocation() - PlayerActor->GetActorLocation();
|
||||||
Direction.Normalize();
|
Direction.Normalize();
|
||||||
FRotator LookAtRotation = FRotationMatrix::MakeFromX(Direction).Rotator();
|
FRotator LookAtRotation = FRotationMatrix::MakeFromX(Direction).Rotator();
|
||||||
@ -169,11 +172,17 @@ void ATurnBaseCombatV2::EndCombat()
|
|||||||
//Enable Character Movement
|
//Enable Character Movement
|
||||||
//Set to Game Mode Only
|
//Set to Game Mode Only
|
||||||
APlayerController* PlayerController = GetWorld()->GetFirstPlayerController();
|
APlayerController* PlayerController = GetWorld()->GetFirstPlayerController();
|
||||||
|
PlayerController->SetInputMode(FInputModeGameOnly());
|
||||||
PlayerController->SetIgnoreMoveInput(false);
|
PlayerController->SetIgnoreMoveInput(false);
|
||||||
PlayerController->SetIgnoreLookInput(false);
|
PlayerController->SetIgnoreLookInput(false);
|
||||||
PlayerController->SetInputMode(FInputModeGameOnly());
|
|
||||||
PlayerController->bShowMouseCursor = false;
|
PlayerController->bShowMouseCursor = false;
|
||||||
|
|
||||||
|
//Enable Character Movement
|
||||||
|
if (ACharacter* PlayerCharacter = Cast<ACharacter>(GetWorld()->GetFirstPlayerController()->GetPawn()))
|
||||||
|
{
|
||||||
|
PlayerCharacter->EnableInput(GetWorld()->GetFirstPlayerController());
|
||||||
|
}
|
||||||
|
|
||||||
if (IsValid(EnemyActor))
|
if (IsValid(EnemyActor))
|
||||||
{
|
{
|
||||||
FProperty* IsBossProperty = FindFieldChecked<FProperty>(EnemyActor->GetClass(), "IsBoss");
|
FProperty* IsBossProperty = FindFieldChecked<FProperty>(EnemyActor->GetClass(), "IsBoss");
|
||||||
|
Loading…
Reference in New Issue
Block a user