Added Perform Function to Execute Actions from Planner
This commit is contained in:
parent
acdb4dde0e
commit
3c8ab3b25e
BIN
COMP250_1_2101327_AI/Content/StarterContent/Audio/Collapse01.uasset
(Stored with Git LFS)
BIN
COMP250_1_2101327_AI/Content/StarterContent/Audio/Collapse01.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
COMP250_1_2101327_AI/Content/StarterContent/Blueprints/Blueprint_CeilingLight.uasset
(Stored with Git LFS)
BIN
COMP250_1_2101327_AI/Content/StarterContent/Blueprints/Blueprint_CeilingLight.uasset
(Stored with Git LFS)
Binary file not shown.
@ -10,3 +10,11 @@ void UCombo_P::Init()
|
||||
Effects.Add("PlayerHealth", 15);
|
||||
Effects.Add("ProbertiumResource", 5);
|
||||
}
|
||||
|
||||
bool UCombo_P::Perform()
|
||||
{
|
||||
ATurnBaseCombatV2* CombatSystem = Cast<ATurnBaseCombatV2>(GetWorld()->GetGameState());
|
||||
CombatSystem->DamagePlayer(15, "P");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -16,4 +16,5 @@ class COMP250_1_2101327_AI_API UCombo_P : public UGOAPAction
|
||||
|
||||
public:
|
||||
virtual void Init() override;
|
||||
virtual bool Perform() override;
|
||||
};
|
||||
|
@ -5,7 +5,15 @@
|
||||
|
||||
void UDefaultAttack::Init()
|
||||
{
|
||||
ActionCost = 2.0f;
|
||||
PreConditions.Add("PlayerHealth", 10);
|
||||
Effects.Add("PlayerHealth", 10);
|
||||
ActionCost = 5.0f;
|
||||
PreConditions.Add("PlayerHealth", 1);
|
||||
Effects.Add("PlayerHealth", 1);
|
||||
}
|
||||
|
||||
bool UDefaultAttack::Perform()
|
||||
{
|
||||
ATurnBaseCombatV2* CombatSystem = Cast<ATurnBaseCombatV2>(GetWorld()->GetGameState());
|
||||
CombatSystem->DamagePlayer(1, "Punch");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -16,4 +16,5 @@ class COMP250_1_2101327_AI_API UDefaultAttack : public UGOAPAction
|
||||
|
||||
public:
|
||||
virtual void Init() override;
|
||||
virtual bool Perform() override;
|
||||
};
|
||||
|
@ -26,3 +26,8 @@ TMap<FString, int> UGOAPAction::ApplyEffects(TMap<FString, int> WorldState)
|
||||
}
|
||||
return WorldState;
|
||||
}
|
||||
|
||||
bool UGOAPAction::Perform()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "UObject/Object.h"
|
||||
#include "COMP250_1_2101327_AI/TurnBasedCombatV2/TurnBaseCombatV2.h"
|
||||
#include "GOAPAction.generated.h"
|
||||
|
||||
/**
|
||||
@ -21,6 +22,8 @@ public:
|
||||
bool CheckPreConditions(TMap<FString, int> WorldState);
|
||||
UFUNCTION()
|
||||
TMap<FString, int> ApplyEffects(TMap<FString, int> WorldState);
|
||||
UFUNCTION()
|
||||
virtual bool Perform();
|
||||
|
||||
UPROPERTY()
|
||||
TMap<FString, int> PreConditions;
|
||||
|
Loading…
Reference in New Issue
Block a user