From acdb4dde0e6238e1197b05e720afd5898e07062b Mon Sep 17 00:00:00 2001 From: PHILIP White Date: Mon, 20 Mar 2023 07:31:24 +0000 Subject: [PATCH] Updated Combat System to Test GOAP Functionality --- .../TurnBasedCombatV2/TurnBaseCombatV2.cpp | 9 +++++++++ .../TurnBasedCombatV2/TurnBaseCombatV2.h | 8 ++++++++ 2 files changed, 17 insertions(+) diff --git a/COMP250_1_2101327_AI/Source/COMP250_1_2101327_AI/TurnBasedCombatV2/TurnBaseCombatV2.cpp b/COMP250_1_2101327_AI/Source/COMP250_1_2101327_AI/TurnBasedCombatV2/TurnBaseCombatV2.cpp index 3fb63ab..36b54a7 100644 --- a/COMP250_1_2101327_AI/Source/COMP250_1_2101327_AI/TurnBasedCombatV2/TurnBaseCombatV2.cpp +++ b/COMP250_1_2101327_AI/Source/COMP250_1_2101327_AI/TurnBasedCombatV2/TurnBaseCombatV2.cpp @@ -7,6 +7,7 @@ #include "StatusSystem.h" #include "Blueprint/UserWidget.h" #include "BehaviorTree/BlackboardComponent.h" +#include "COMP250_1_2101327_AI/GOAP/GOAPAgent.h" #include "Components/TextBlock.h" #include "Components/ProgressBar.h" #include "GameFramework/Character.h" @@ -61,6 +62,11 @@ void ATurnBaseCombatV2::StartCombat(AActor* Enemy) AzosResource = 10; IroquoidResource = 10; + EnemyProbertiumResource = 10; + EnemyEisResource = 10; + EnemyAzosResource = 10; + EnemyIroquoidResource = 10; + //Disable Character Movement if (ACharacter* PlayerCharacter = Cast(GetWorld()->GetFirstPlayerController()->GetPawn())) { @@ -85,6 +91,9 @@ void ATurnBaseCombatV2::StartCombat(AActor* Enemy) UpdateActionPoints(); UpdateResourceBars(); ClearBattleLog(); + + UGOAPAgent* EnemyGOAPAgent = Cast(Enemy->GetComponentByClass(UGOAPAgent::StaticClass())); + TArray Plannn = EnemyGOAPAgent->Plan(EnemyGOAPAgent->GetWorldState(), EnemyGOAPAgent->Goals); } void ATurnBaseCombatV2::EndCombat() diff --git a/COMP250_1_2101327_AI/Source/COMP250_1_2101327_AI/TurnBasedCombatV2/TurnBaseCombatV2.h b/COMP250_1_2101327_AI/Source/COMP250_1_2101327_AI/TurnBasedCombatV2/TurnBaseCombatV2.h index 04d32e2..a4cbdae 100644 --- a/COMP250_1_2101327_AI/Source/COMP250_1_2101327_AI/TurnBasedCombatV2/TurnBaseCombatV2.h +++ b/COMP250_1_2101327_AI/Source/COMP250_1_2101327_AI/TurnBasedCombatV2/TurnBaseCombatV2.h @@ -38,6 +38,14 @@ public: int AzosResource = 10; UPROPERTY(EditDefaultsOnly) int IroquoidResource = 10; + UPROPERTY(EditDefaultsOnly) + int EnemyProbertiumResource = 10; + UPROPERTY(EditDefaultsOnly) + int EnemyEisResource = 10; + UPROPERTY(EditDefaultsOnly) + int EnemyAzosResource = 10; + UPROPERTY(EditDefaultsOnly) + int EnemyIroquoidResource = 10; UPROPERTY(EditDefaultsOnly) UNiagaraSystem* GunEffect;