Update DemolitionWorker with new BehaviorTrees
This commit is contained in:
parent
1f3e8a09ea
commit
a2186205cc
BIN
Content/Enemy/BB_Base_Enemy.uasset (Stored with Git LFS)
BIN
Content/Enemy/BB_Base_Enemy.uasset (Stored with Git LFS)
Binary file not shown.
BIN
Content/Enemy/DemolitionWorker/BT_DemolitionWorker.uasset (Stored with Git LFS)
BIN
Content/Enemy/DemolitionWorker/BT_DemolitionWorker.uasset (Stored with Git LFS)
Binary file not shown.
BIN
Content/Enemy/DemolitionWorker/C_DemolitionWorker.uasset (Stored with Git LFS)
BIN
Content/Enemy/DemolitionWorker/C_DemolitionWorker.uasset (Stored with Git LFS)
Binary file not shown.
BIN
Content/Enemy/Worker/BT_Worker.uasset (Stored with Git LFS)
BIN
Content/Enemy/Worker/BT_Worker.uasset (Stored with Git LFS)
Binary file not shown.
BIN
Content/Enemy/Worker/C_Worker.uasset (Stored with Git LFS)
BIN
Content/Enemy/Worker/C_Worker.uasset (Stored with Git LFS)
Binary file not shown.
|
@ -4,6 +4,13 @@
|
||||||
#include "DemolitionCharacter.h"
|
#include "DemolitionCharacter.h"
|
||||||
#include <Kismet/GameplayStatics.h>
|
#include <Kismet/GameplayStatics.h>
|
||||||
|
|
||||||
|
void ADemolitionCharacter::BeginPlay()
|
||||||
|
{
|
||||||
|
Super::BeginPlay();
|
||||||
|
|
||||||
|
GetHealthComponent()->OnDeath.BindUFunction(this, "Explode");
|
||||||
|
}
|
||||||
|
|
||||||
void ADemolitionCharacter::Explode()
|
void ADemolitionCharacter::Explode()
|
||||||
{
|
{
|
||||||
GetHealthComponent()->TakeDamage(this, this->GetHealthComponent()->GetMaxHealth(), nullptr, nullptr, nullptr);
|
GetHealthComponent()->TakeDamage(this, this->GetHealthComponent()->GetMaxHealth(), nullptr, nullptr, nullptr);
|
||||||
|
|
|
@ -30,6 +30,8 @@ protected:
|
||||||
UPROPERTY(EditDefaultsOnly)
|
UPROPERTY(EditDefaultsOnly)
|
||||||
float MaxDamage = 150.f;
|
float MaxDamage = 150.f;
|
||||||
|
|
||||||
|
virtual void BeginPlay() override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
UFUNCTION()
|
UFUNCTION()
|
||||||
void Explode();
|
void Explode();
|
||||||
|
|
|
@ -25,9 +25,10 @@ EBTNodeResult::Type UGetDistanceToPlayerTask::ExecuteTask(UBehaviorTreeComponent
|
||||||
|
|
||||||
if (distance < DistanceThreshold)
|
if (distance < DistanceThreshold)
|
||||||
{
|
{
|
||||||
enemyPawn->Explode();
|
blackboardComponent->SetValueAsBool(IsDeadKey.SelectedKeyName, true);
|
||||||
enemyPawn->GetHealthComponent()->TakeDamage(enemyPawn, enemyPawn->GetHealthComponent()->GetMaxHealth(), nullptr,
|
enemyPawn->GetHealthComponent()->TakeDamage(enemyPawn, enemyPawn->GetHealthComponent()->GetMaxHealth(), nullptr,
|
||||||
nullptr, nullptr);
|
enemyController, enemyPawn);
|
||||||
|
// enemyPawn->Explode();
|
||||||
return EBTNodeResult::Succeeded;
|
return EBTNodeResult::Succeeded;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,9 @@ private:
|
||||||
UPROPERTY(EditAnywhere, Meta = (AllowPrivateAccess = "true"))
|
UPROPERTY(EditAnywhere, Meta = (AllowPrivateAccess = "true"))
|
||||||
FBlackboardKeySelector TargetActor;
|
FBlackboardKeySelector TargetActor;
|
||||||
|
|
||||||
|
UPROPERTY(EditAnywhere, Meta = (AllowPrivateAccess = "true"))
|
||||||
|
FBlackboardKeySelector IsDeadKey;
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere, Meta = (AllowPrivateAccess = "true"))
|
UPROPERTY(EditAnywhere, Meta = (AllowPrivateAccess = "true"))
|
||||||
float DistanceThreshold = 5.0f;
|
float DistanceThreshold = 5.0f;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue