Updated Combat System to Hide Quest Widget in Combat

This commit is contained in:
Philip W 2023-05-09 00:42:03 +01:00
parent 38591bfcac
commit 0115b7db1f
2 changed files with 7 additions and 3 deletions

View File

@ -32,6 +32,9 @@ public:
UPROPERTY(VisibleAnywhere, BlueprintReadOnly) UPROPERTY(VisibleAnywhere, BlueprintReadOnly)
bool bHasSubQuest = false; bool bHasSubQuest = false;
UPROPERTY()
UUserWidget* QuestWidgetInstance;
protected: protected:
// Called when the game starts // Called when the game starts
virtual void BeginPlay() override; virtual void BeginPlay() override;
@ -39,8 +42,6 @@ protected:
UPROPERTY() UPROPERTY()
TSubclassOf<UUserWidget> QuestWidget; TSubclassOf<UUserWidget> QuestWidget;
UPROPERTY() UPROPERTY()
UUserWidget* QuestWidgetInstance;
UPROPERTY()
TSubclassOf<UUserWidget> QuestCompletionWidget; TSubclassOf<UUserWidget> QuestCompletionWidget;
UPROPERTY() UPROPERTY()
UUserWidget* QuestCompletionWidgetInstance; UUserWidget* QuestCompletionWidgetInstance;

View File

@ -13,6 +13,7 @@
#include "Kismet/KismetMathLibrary.h" #include "Kismet/KismetMathLibrary.h"
#include "Misc/OutputDeviceNull.h" #include "Misc/OutputDeviceNull.h"
#include "the_twilight_abyss/PlayerTemp/TempCharacter.h" #include "the_twilight_abyss/PlayerTemp/TempCharacter.h"
#include "the_twilight_abyss/Quest/QuestSystem.h"
// Sets default values // Sets default values
ATurnBaseCombatV2::ATurnBaseCombatV2() ATurnBaseCombatV2::ATurnBaseCombatV2()
@ -46,7 +47,8 @@ void ATurnBaseCombatV2::StartCombat(AActor* Enemy, bool bWasShot)
EscapePercentageTextBlock->SetText(FText::Join(FText::FromString(""), FText::FromString(FString::FromInt(EscapePercentage * 100)), FText::FromString("%"))); EscapePercentageTextBlock->SetText(FText::Join(FText::FromString(""), FText::FromString(FString::FromInt(EscapePercentage * 100)), FText::FromString("%")));
bIsInCombat = true; bIsInCombat = true;
UBlackboardComponent* EnemyBlackboard = Cast<AAIController>(Enemy->GetInstigatorController())->GetBlackboardComponent(); UBlackboardComponent* EnemyBlackboard = Cast<AAIController>(Enemy->GetInstigatorController())->GetBlackboardComponent();
Cast<UQuestSystem>(PlayerActor->GetComponentByClass(UQuestSystem::StaticClass()))->QuestWidgetInstance->SetVisibility(ESlateVisibility::Hidden);
//Disable Character Movement //Disable Character Movement
APlayerController* PlayerController = GetWorld()->GetFirstPlayerController(); APlayerController* PlayerController = GetWorld()->GetFirstPlayerController();
PlayerController->SetIgnoreMoveInput(true); PlayerController->SetIgnoreMoveInput(true);
@ -126,6 +128,7 @@ void ATurnBaseCombatV2::EndCombat()
BookHUD->SetVisibility(ESlateVisibility::Hidden); BookHUD->SetVisibility(ESlateVisibility::Hidden);
HUD->RemoveFromParent(); HUD->RemoveFromParent();
BookStaticMeshComponent->SetVisibility(false); BookStaticMeshComponent->SetVisibility(false);
Cast<UQuestSystem>(PlayerActor->GetComponentByClass(UQuestSystem::StaticClass()))->QuestWidgetInstance->SetVisibility(ESlateVisibility::HitTestInvisible);
Cast<ATempCharacter>(PlayerActor)->ResetWidgetPointer(); Cast<ATempCharacter>(PlayerActor)->ResetWidgetPointer();
TurnIndicatorTextBlock->SetText(FText::FromString("")); TurnIndicatorTextBlock->SetText(FText::FromString(""));
bEnemyHasExtraTurn = false; bEnemyHasExtraTurn = false;