Updated Combat to Hide Book in Non-Combat

This commit is contained in:
Philip W 2023-04-27 07:19:19 +01:00
parent 11c905613a
commit 4f8f2b37d1
3 changed files with 11 additions and 2 deletions

Binary file not shown.

View File

@ -40,6 +40,7 @@ void ATurnBaseCombatV2::StartCombat(AActor* Enemy, bool bWasShot)
if (bIsInCombat) return;
BookHUD->SetVisibility(ESlateVisibility::SelfHitTestInvisible);
HUD->AddToViewport(-1);
BookStaticMeshComponent->SetVisibility(true);
EscapePercentage = CalculateEscapePercentage();
EscapePercentageTextBlock->SetText(FText::Join(FText::FromString(""), FText::FromString(FString::FromInt(EscapePercentage * 100)), FText::FromString("%")));
bIsInCombat = true;
@ -113,6 +114,7 @@ void ATurnBaseCombatV2::EndCombat()
{
BookHUD->SetVisibility(ESlateVisibility::Hidden);
HUD->RemoveFromParent();
BookStaticMeshComponent->SetVisibility(false);
Cast<ATempCharacter>(PlayerActor)->ResetWidgetPointer();
TurnIndicatorTextBlock->SetText(FText::FromString(""));
bEnemyHasExtraTurn = false;
@ -164,6 +166,11 @@ void ATurnBaseCombatV2::BeginPlay()
PostProcessVolume->Settings.WeightedBlendables.Array.Add(WeightedBlendable);
}
TArray<UStaticMeshComponent*> StaticMeshComponents;
PlayerActor->GetComponents<UStaticMeshComponent>(StaticMeshComponents);
BookStaticMeshComponent = StaticMeshComponents[1];
BookStaticMeshComponent->SetVisibility(false);
CombatTutorialWidgetInstance = CreateWidget<UUserWidget>(GetWorld(), CombatTutorialWidget);
HUD = CreateWidget<UUserWidget>(GetWorld(), HUDWidget);
TArray<AActor*> PlayerChildActors;

View File

@ -237,4 +237,6 @@ private:
UUserWidget* DeathScreenWidget;
UPROPERTY()
TSubclassOf<UUserWidget> DeathScreenWidgetSubclass;
UPROPERTY()
UStaticMeshComponent* BookStaticMeshComponent;
};