From 45374da8bb51e6df539b6c11ae0edf4112b7c544 Mon Sep 17 00:00:00 2001 From: PHILIP White Date: Tue, 31 Jan 2023 01:39:42 +0000 Subject: [PATCH] Updated Combat System to Disengage from Combat --- Content/BlueprintAI/AI/BT_Bruh.uasset | 4 ++-- Content/Blueprints/Combat_UI/Combat_UI.uasset | 4 ++-- .../TurnBasedCombatV2/TurnBaseCombatV2.cpp | 11 +++++++++++ .../TurnBasedCombatV2/TurnBaseCombatV2.h | 6 ++++++ 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/Content/BlueprintAI/AI/BT_Bruh.uasset b/Content/BlueprintAI/AI/BT_Bruh.uasset index 2d51dcb..8c9e379 100644 --- a/Content/BlueprintAI/AI/BT_Bruh.uasset +++ b/Content/BlueprintAI/AI/BT_Bruh.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e1d788b5da4588cdcc0f487c37f6fb0de042672d3e874cbfad39b12336ede9fc -size 22998 +oid sha256:3808112aa42d25a44b52ffafe6703131ffa192d567f3b563aad1f433f066ff23 +size 22630 diff --git a/Content/Blueprints/Combat_UI/Combat_UI.uasset b/Content/Blueprints/Combat_UI/Combat_UI.uasset index aeebd00..416a260 100644 --- a/Content/Blueprints/Combat_UI/Combat_UI.uasset +++ b/Content/Blueprints/Combat_UI/Combat_UI.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1f42716c7e52f59d5e57aabb8ff5699d656b0a43c6f95ad8802a31c9e13e0765 -size 77433 +oid sha256:52a0bccd38454b1877744bb682416d170c6d74c8de74517c8856432b45915b79 +size 78977 diff --git a/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp b/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp index fbf9152..11417e9 100644 --- a/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp +++ b/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp @@ -122,10 +122,12 @@ void ATurnBaseCombatV2::BeginPlay() FButton = Cast(HUD->GetWidgetFromName("FButton")); WButton = Cast(HUD->GetWidgetFromName("WButton")); BackspaceButton = Cast(HUD->GetWidgetFromName("BackspaceButton")); + RunButton = Cast(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(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() diff --git a/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.h b/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.h index 88f918d..283ef1e 100644 --- a/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.h +++ b/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.h @@ -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;