Add reworked Worker Enemy AI #3
							
								
								
									
										
											BIN
										
									
								
								Content/Enemy/BT_Attacking_State.uasset
									 (Stored with Git LFS)
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Content/Enemy/BT_Attacking_State.uasset
									 (Stored with Git LFS)
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										23
									
								
								Source/Nakatomi/Decorators/BTDWeaponCooldown.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								Source/Nakatomi/Decorators/BTDWeaponCooldown.cpp
									
									
									
									
									
										Normal file
									
								
							@ -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<AEnemyCharacter>(OwnerComp.GetAIOwner()->GetPawn());
 | 
			
		||||
 | 
			
		||||
	if (EnemyCharacter && EnemyCharacter->GetCurrentWeapon())
 | 
			
		||||
	{
 | 
			
		||||
		const float Cooldown = EnemyCharacter->GetCurrentWeapon()->GetWeaponProperties()->WeaponCooldown;
 | 
			
		||||
		if (CoolDownTime != Cooldown)
 | 
			
		||||
		{
 | 
			
		||||
			CoolDownTime = Cooldown;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	Super::TickNode(OwnerComp, NodeMemory, DeltaSeconds);
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										19
									
								
								Source/Nakatomi/Decorators/BTDWeaponCooldown.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								Source/Nakatomi/Decorators/BTDWeaponCooldown.h
									
									
									
									
									
										Normal file
									
								
							@ -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;
 | 
			
		||||
};
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user