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 <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);
|
||||
|
|
|
@ -30,6 +30,8 @@ protected:
|
|||
UPROPERTY(EditDefaultsOnly)
|
||||
float MaxDamage = 150.f;
|
||||
|
||||
virtual void BeginPlay() override;
|
||||
|
||||
public:
|
||||
UFUNCTION()
|
||||
void Explode();
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue