Updated Combat System to Disengage from Combat

This commit is contained in:
Philip W 2023-01-31 01:39:42 +00:00
parent 5b60412cf9
commit 45374da8bb
4 changed files with 21 additions and 4 deletions

BIN
Content/BlueprintAI/AI/BT_Bruh.uasset (Stored with Git LFS)

Binary file not shown.

Binary file not shown.

View File

@ -122,10 +122,12 @@ void ATurnBaseCombatV2::BeginPlay()
FButton = Cast<UButton>(HUD->GetWidgetFromName("FButton"));
WButton = Cast<UButton>(HUD->GetWidgetFromName("WButton"));
BackspaceButton = Cast<UButton>(HUD->GetWidgetFromName("BackspaceButton"));
RunButton = Cast<UButton>(HUD->GetWidgetFromName("RunButton"));
CastButton->OnClicked.AddDynamic(this, &ATurnBaseCombatV2::CastButtonOnClick);
FButton->OnClicked.AddDynamic(this, &ATurnBaseCombatV2::FButtonOnClick);
WButton->OnClicked.AddDynamic(this, &ATurnBaseCombatV2::WButtonOnClick);
BackspaceButton->OnClicked.AddDynamic(this, &ATurnBaseCombatV2::BackspaceButtonOnClick);
RunButton->OnClicked.AddDynamic(this, &ATurnBaseCombatV2::RunButtonOnClick);
}
void ATurnBaseCombatV2::ExecuteCast(FString Combo)
@ -315,6 +317,14 @@ void ATurnBaseCombatV2::BackspaceButtonOnClick()
UpdateResourceBars();
}
void ATurnBaseCombatV2::RunButtonOnClick()
{
UBlackboardComponent* EnemyBlackboard = Cast<AAIController>(EnemyActor->GetInstigatorController())->GetBlackboardComponent();
EnemyBlackboard->SetValueAsBool("IsInCombat", false);
EndCombat();
}
void ATurnBaseCombatV2::UpdateComboString(FString NewCombo) const
{
CurrentComboTextBlock->SetText(FText::FromString(NewCombo));
@ -358,6 +368,7 @@ void ATurnBaseCombatV2::ToggleButtons() const
WButton->SetIsEnabled(!WButton->GetIsEnabled());
BackspaceButton->SetIsEnabled(!BackspaceButton->GetIsEnabled());
CastButton->SetIsEnabled(!CastButton->GetIsEnabled());
RunButton->SetIsEnabled(!RunButton->GetIsEnabled());
}
void ATurnBaseCombatV2::EnemyTurn()

View File

@ -126,6 +126,9 @@ private:
UPROPERTY(VisibleAnywhere)
UButton* BackspaceButton;
UPROPERTY(VisibleAnywhere)
UButton* RunButton;
UFUNCTION()
void CastButtonOnClick();
@ -138,6 +141,9 @@ private:
UFUNCTION()
void BackspaceButtonOnClick();
UFUNCTION()
void RunButtonOnClick();
void UpdateComboString(FString NewCombo) const;
void UpdateActionPoints() const;