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.
@ -9,4 +9,12 @@ void UCombo_P::Init()
|
|||||||
PreConditions.Add("ProbertiumResource", 5);
|
PreConditions.Add("ProbertiumResource", 5);
|
||||||
Effects.Add("PlayerHealth", 15);
|
Effects.Add("PlayerHealth", 15);
|
||||||
Effects.Add("ProbertiumResource", 5);
|
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:
|
public:
|
||||||
virtual void Init() override;
|
virtual void Init() override;
|
||||||
|
virtual bool Perform() override;
|
||||||
};
|
};
|
||||||
|
@ -5,7 +5,15 @@
|
|||||||
|
|
||||||
void UDefaultAttack::Init()
|
void UDefaultAttack::Init()
|
||||||
{
|
{
|
||||||
ActionCost = 2.0f;
|
ActionCost = 5.0f;
|
||||||
PreConditions.Add("PlayerHealth", 10);
|
PreConditions.Add("PlayerHealth", 1);
|
||||||
Effects.Add("PlayerHealth", 10);
|
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:
|
public:
|
||||||
virtual void Init() override;
|
virtual void Init() override;
|
||||||
|
virtual bool Perform() override;
|
||||||
};
|
};
|
||||||
|
@ -26,3 +26,8 @@ TMap<FString, int> UGOAPAction::ApplyEffects(TMap<FString, int> WorldState)
|
|||||||
}
|
}
|
||||||
return WorldState;
|
return WorldState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool UGOAPAction::Perform()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "UObject/Object.h"
|
#include "UObject/Object.h"
|
||||||
|
#include "COMP250_1_2101327_AI/TurnBasedCombatV2/TurnBaseCombatV2.h"
|
||||||
#include "GOAPAction.generated.h"
|
#include "GOAPAction.generated.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -21,7 +22,9 @@ public:
|
|||||||
bool CheckPreConditions(TMap<FString, int> WorldState);
|
bool CheckPreConditions(TMap<FString, int> WorldState);
|
||||||
UFUNCTION()
|
UFUNCTION()
|
||||||
TMap<FString, int> ApplyEffects(TMap<FString, int> WorldState);
|
TMap<FString, int> ApplyEffects(TMap<FString, int> WorldState);
|
||||||
|
UFUNCTION()
|
||||||
|
virtual bool Perform();
|
||||||
|
|
||||||
UPROPERTY()
|
UPROPERTY()
|
||||||
TMap<FString, int> PreConditions;
|
TMap<FString, int> PreConditions;
|
||||||
UPROPERTY()
|
UPROPERTY()
|
||||||
|
Loading…
Reference in New Issue
Block a user