Update DemolitionWorker with new BehaviorTrees

This commit is contained in:
baz 2024-02-29 20:01:41 +00:00
parent 1f3e8a09ea
commit a2186205cc
9 changed files with 25 additions and 12 deletions

BIN
Content/Enemy/BB_Base_Enemy.uasset (Stored with Git LFS)

Binary file not shown.

Binary file not shown.

Binary file not shown.

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)

Binary file not shown.

View File

@ -4,6 +4,13 @@
#include "DemolitionCharacter.h"
#include <Kismet/GameplayStatics.h>
void ADemolitionCharacter::BeginPlay()
{
Super::BeginPlay();
GetHealthComponent()->OnDeath.BindUFunction(this, "Explode");
}
void ADemolitionCharacter::Explode()
{
GetHealthComponent()->TakeDamage(this, this->GetHealthComponent()->GetMaxHealth(), nullptr, nullptr, nullptr);

View File

@ -30,6 +30,8 @@ protected:
UPROPERTY(EditDefaultsOnly)
float MaxDamage = 150.f;
virtual void BeginPlay() override;
public:
UFUNCTION()
void Explode();

View File

@ -25,9 +25,10 @@ EBTNodeResult::Type UGetDistanceToPlayerTask::ExecuteTask(UBehaviorTreeComponent
if (distance < DistanceThreshold)
{
enemyPawn->Explode();
blackboardComponent->SetValueAsBool(IsDeadKey.SelectedKeyName, true);
enemyPawn->GetHealthComponent()->TakeDamage(enemyPawn, enemyPawn->GetHealthComponent()->GetMaxHealth(), nullptr,
nullptr, nullptr);
enemyController, enemyPawn);
// enemyPawn->Explode();
return EBTNodeResult::Succeeded;
}

View File

@ -23,6 +23,9 @@ private:
UPROPERTY(EditAnywhere, Meta = (AllowPrivateAccess = "true"))
FBlackboardKeySelector TargetActor;
UPROPERTY(EditAnywhere, Meta = (AllowPrivateAccess = "true"))
FBlackboardKeySelector IsDeadKey;
UPROPERTY(EditAnywhere, Meta = (AllowPrivateAccess = "true"))
float DistanceThreshold = 5.0f;