Space Plunder
Loading...
Searching...
No Matches
BTTask_Rotate.h
Go to the documentation of this file.
1// Fill out your copyright notice in the Description page of Project Settings.
2
3#pragma once
4
5#include "CoreMinimal.h"
6#include "BehaviorTree/BTTaskNode.h"
7#include "BTTask_Rotate.generated.h"
8
23UCLASS()
24class AITOOLKIT_API UBTTask_Rotate : public UBTTaskNode
25{
26 GENERATED_BODY()
27
28public:
29
31
32
33 //- 90 degrees = turn right //
34 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI")
35 float RotationDegrees = 90.0f;
36 //- How far forward is there focal point from the eyes //
37 //- Lower number will rotate faster //
38 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI")
39 float ForwardDistance = 500.0f;
40 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI")
41 bool bInstantTurn = true;
42 //- How long does it take to turn //
43 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI")
44 float InterpolationDuration = 2.0f;
45 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI")
46 float RandomDeviation = 0.1f;
47 //- Will rotate left then right the same amount, finishing back in center //
48 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI")
49 bool bLookAround = false;
50 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI")
51 int32 TimesToLookAround = 1;
52
53
54 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI|Debugging")
55 bool bDebuggingMode = false;
56 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI|Debugging")
57 bool bShowCurrentFocus = true;
58 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI|Debugging")
59 bool bShowText = true;
60 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI|Debugging")
61 float PointSize = 20.0f;
62 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI|Debugging")
63 FColor TargetFocalPointColor = FColor::Red;
64 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI|Debugging")
65 float TargetFocalPointDuration = 2.0f;
66 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI|Debugging")
67 FColor CurrentFocalPointColor = FColor::Yellow;
68
69private:
70
72 {
73 FVector TargetLocation = FVector::ZeroVector;
74 FVector TargetOppositeLocation = FVector::ZeroVector;
75
76 FVector FocalPoint = FVector::ZeroVector;
77 float TimeElapsed = 0.0f;
78
79 float RandomDeviationMultiplier = 0.0f;
80
81 int32 LookAroundCount = 0;
82 FVector StartLocation = FVector::ZeroVector;
83 FRotator StartRotation = FRotator::ZeroRotator;
84
85 FVector OriginalLocation = FVector::ZeroVector;
86 FRotator OriginalRotation = FRotator::ZeroRotator;
87
88 float Alpha = 0.0f;
89
90 float AlphaTarget = 1.0f;
91 };
92
93
94protected:
95 virtual EBTNodeResult::Type ExecuteTask(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory) override;
96 virtual EBTNodeResult::Type AbortTask(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory) override;
97 virtual void TickTask(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory, float DeltaSeconds) override;
98
99 virtual uint16 GetInstanceMemorySize() const override;
100 // virtual void OnTaskFinished(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory, EBTNodeResult::Type TaskResult) override;
101 static void ResetNumbers(FBTTaskRotateMemory* RotateMemory);
102
103 void InstantTurn(const FBTTaskRotateMemory* RotateMemory, AAIController* AIController) const;
104 void Turn(FBTTaskRotateMemory* RotateMemory, AAIController* AIController, const bool bForward = true);
105
106 virtual FString GetStaticDescription() const override;
107
108#if WITH_EDITOR
109 virtual FName GetNodeIconName() const override;
110#endif // WITH_EDITOR
111
112
113};
UCLASS(Blueprintable, BlueprintType, ClassGroup=(BucciGames), meta=(BlueprintSpawnableComponent)) class CHATSYSTEM_API UChatSystemComponent
Definition ChatSystemComponent.h:13
A task node that rotates the AI character by a specified number of degrees.
Definition BTTask_Rotate.h:25
Definition BTTask_Rotate.h:72