diff --git a/Content/Enemy/BT_Attacking_State.uasset b/Content/Enemy/BT_Attacking_State.uasset index e84ca7f..ad8ad93 100644 --- a/Content/Enemy/BT_Attacking_State.uasset +++ b/Content/Enemy/BT_Attacking_State.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8a5236e64bd434f6de908e6e96b843882a5b2b94caf1301b2473f05100a85d26 -size 25814 +oid sha256:d2d10560f8fc5d39c97cae7f1db8463469d5723c0966a4ee8a69fe5f986a9f0a +size 25779 diff --git a/Source/Nakatomi/Decorators/BTDWeaponCooldown.cpp b/Source/Nakatomi/Decorators/BTDWeaponCooldown.cpp new file mode 100644 index 0000000..3855d0b --- /dev/null +++ b/Source/Nakatomi/Decorators/BTDWeaponCooldown.cpp @@ -0,0 +1,23 @@ +// Fill out your copyright notice in the Description page of Project Settings. + + +#include "../Decorators/BTDWeaponCooldown.h" + +#include "AIController.h" +#include "Nakatomi/EnemyCharacter.h" + +void UBTDWeaponCooldown::TickNode(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory, float DeltaSeconds) +{ + AEnemyCharacter* EnemyCharacter = Cast(OwnerComp.GetAIOwner()->GetPawn()); + + if (EnemyCharacter && EnemyCharacter->GetCurrentWeapon()) + { + const float Cooldown = EnemyCharacter->GetCurrentWeapon()->GetWeaponProperties()->WeaponCooldown; + if (CoolDownTime != Cooldown) + { + CoolDownTime = Cooldown; + } + } + + Super::TickNode(OwnerComp, NodeMemory, DeltaSeconds); +} diff --git a/Source/Nakatomi/Decorators/BTDWeaponCooldown.h b/Source/Nakatomi/Decorators/BTDWeaponCooldown.h new file mode 100644 index 0000000..5367200 --- /dev/null +++ b/Source/Nakatomi/Decorators/BTDWeaponCooldown.h @@ -0,0 +1,19 @@ +// Fill out your copyright notice in the Description page of Project Settings. + +#pragma once + +#include "CoreMinimal.h" +#include "BehaviorTree/Decorators/BTDecorator_Cooldown.h" +#include "BTDWeaponCooldown.generated.h" + +/** + * + */ +UCLASS() +class NAKATOMI_API UBTDWeaponCooldown : public UBTDecorator_Cooldown +{ + GENERATED_BODY() + +protected: + virtual void TickNode(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory, float DeltaSeconds) override; +};