LEAP Documentation 40220
Documentation for the LEAP project
BTTask_FireWeapon.h
Go to the documentation of this file.
1// Copyright Blue Isle Studios Inc 2022. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
6#include "BehaviorTree/Tasks/BTTask_BlackboardBase.h"
7#include "BTTask_FireWeapon.generated.h"
8
9class UWeaponComponent;
10
11UCLASS()
12class PROJECTX_API UBTTask_FireWeapon : public UBTTaskNode
13{
14 GENERATED_BODY()
15
16public:
17 /* Should this weapon fire it's secondary mode? Often the secondary is used for tight-aiming */
18 UPROPERTY(Category = Node, EditAnywhere)
19 bool bAltFire = false;
20 /* Should this weapon fire it's primary mode? */
21 UPROPERTY(Category = Node, EditAnywhere)
22 bool bPrimaryFire = false;
23 /* Should the ai hold the fire button until this task ends, or should it be a quick tap fire and forget? */
24 UPROPERTY(Category = Node, EditAnywhere)
25 bool bHoldFire = true;
26 /* How much of a delay should we have before firing? A random number will be chosen each time between max and min value */
27 UPROPERTY(Category = Node, EditAnywhere)
28 FVector2D FireDelay = FVector2D(0.2f, 0.5f);
29
30 virtual EBTNodeResult::Type ExecuteTask(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory) override;
31 virtual EBTNodeResult::Type AbortTask(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory) override;
32 virtual void ExecuteTaskDelayed(TWeakObjectPtr<UBehaviorTreeComponent> OwnerComp);
33
34 UFUNCTION()
35 void ReloadStart(UWeaponComponent* WeaponComponent);
36 UFUNCTION()
37 void ReloadStop(UWeaponComponent* WeaponComponent);
38
39 void Fire(UWeaponComponent* WeaponComponent);
40 void FireRelased(UWeaponComponent* WeaponComponent);
41
42private:
43 TMap<uint32, FTimerHandle> TimerHandles;
44};
Definition: BTTask_FireWeapon.h:13