diff --git a/Content/Enemy/BB_Base_Enemy.uasset b/Content/Enemy/BB_Base_Enemy.uasset index 4754676..0b1e136 100644 --- a/Content/Enemy/BB_Base_Enemy.uasset +++ b/Content/Enemy/BB_Base_Enemy.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7d05342d401b4b8dc0c3e28fb9a9169cc305b78b1029be1d7f5d85d0d45c1014 -size 5253 +oid sha256:a2abd7ac5d5932781a853e700ac56a2fef6e78815c048c50bae0896c63b7ea98 +size 5609 diff --git a/Content/Enemy/DemolitionWorker/BT_DemolitionWorker.uasset b/Content/Enemy/DemolitionWorker/BT_DemolitionWorker.uasset index b856f5b..cacf864 100644 --- a/Content/Enemy/DemolitionWorker/BT_DemolitionWorker.uasset +++ b/Content/Enemy/DemolitionWorker/BT_DemolitionWorker.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7468f86c09ba9525cb7c8d6dea4ea391f1e47b9fd06f6ad9dc747a6849055e72 -size 11978 +oid sha256:ea18f495a0a86ab9f54e20a68601596b6a8b5d2393cf73b00f2b4dd9ed0105da +size 20524 diff --git a/Content/Enemy/DemolitionWorker/C_DemolitionWorker.uasset b/Content/Enemy/DemolitionWorker/C_DemolitionWorker.uasset index 66a987c..86420a2 100644 --- a/Content/Enemy/DemolitionWorker/C_DemolitionWorker.uasset +++ b/Content/Enemy/DemolitionWorker/C_DemolitionWorker.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:518f55a062ac5296c50dbab1e53771343b96520ab86d16c4b83af379cdd7cb4b -size 35111 +oid sha256:943300743f1be0b9baedc3e0d558422766bd81ee27e12b598e2d397be5bcf135 +size 39247 diff --git a/Content/Enemy/Worker/BT_Worker.uasset b/Content/Enemy/Worker/BT_Worker.uasset index 2727938..0262c5e 100644 --- a/Content/Enemy/Worker/BT_Worker.uasset +++ b/Content/Enemy/Worker/BT_Worker.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1aa0439b160b9cc4a744f2efdbb6131ffeb1aec8a50685dea2f921cae8be614e -size 33660 +oid sha256:e81b426ebcb38076ae6faaf154e3e6d13be48305765cb0a7ce87a4a1a769fc30 +size 35307 diff --git a/Content/Enemy/Worker/C_Worker.uasset b/Content/Enemy/Worker/C_Worker.uasset index cdcd13d..e8217ef 100644 --- a/Content/Enemy/Worker/C_Worker.uasset +++ b/Content/Enemy/Worker/C_Worker.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1307c6303ccede36903875211f758077933ef495e0fb8aebe8c45147e9cfb66d -size 38588 +oid sha256:647419ab6808d250ddabd27e0c4f66e6e01bc4a511e6fb227e5bdbc84e05faa1 +size 40378 diff --git a/Source/Nakatomi/DemolitionCharacter.cpp b/Source/Nakatomi/DemolitionCharacter.cpp index 1e1ce4c..5371acd 100644 --- a/Source/Nakatomi/DemolitionCharacter.cpp +++ b/Source/Nakatomi/DemolitionCharacter.cpp @@ -4,6 +4,13 @@ #include "DemolitionCharacter.h" #include +void ADemolitionCharacter::BeginPlay() +{ + Super::BeginPlay(); + + GetHealthComponent()->OnDeath.BindUFunction(this, "Explode"); +} + void ADemolitionCharacter::Explode() { GetHealthComponent()->TakeDamage(this, this->GetHealthComponent()->GetMaxHealth(), nullptr, nullptr, nullptr); diff --git a/Source/Nakatomi/DemolitionCharacter.h b/Source/Nakatomi/DemolitionCharacter.h index 58c393f..22cdfc7 100644 --- a/Source/Nakatomi/DemolitionCharacter.h +++ b/Source/Nakatomi/DemolitionCharacter.h @@ -30,6 +30,8 @@ protected: UPROPERTY(EditDefaultsOnly) float MaxDamage = 150.f; + virtual void BeginPlay() override; + public: UFUNCTION() void Explode(); diff --git a/Source/Nakatomi/GetDistanceToPlayerTask.cpp b/Source/Nakatomi/GetDistanceToPlayerTask.cpp index ea6b0ea..2344b39 100644 --- a/Source/Nakatomi/GetDistanceToPlayerTask.cpp +++ b/Source/Nakatomi/GetDistanceToPlayerTask.cpp @@ -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; } diff --git a/Source/Nakatomi/GetDistanceToPlayerTask.h b/Source/Nakatomi/GetDistanceToPlayerTask.h index 200137d..cd87759 100644 --- a/Source/Nakatomi/GetDistanceToPlayerTask.h +++ b/Source/Nakatomi/GetDistanceToPlayerTask.h @@ -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;