Space Plunder
Loading...
Searching...
No Matches
AITraitsComponent.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"
7#include "Data/AIDataTypes.h"
8#include "AITraitsComponent.generated.h"
9
10
12struct FAIStimulus;
13DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnAlertLevelChanged, float, DetectionLevel, EAIStateType, AIStateType,
14 AActor*, TargetActor);
16
17
18UCLASS(Blueprintable, BlueprintType, ClassGroup=(BucciGames), meta=(BlueprintSpawnableComponent) )
19class AITOOLKIT_API UAITraitsComponent : public UCharacterComponent
20{
21 GENERATED_BODY()
22
23public:
24
25 UAITraitsComponent();
26
27 UPROPERTY(BlueprintAssignable, Category="AI")
28 FOnAlertLevelChanged OnAlertLevelChanged;
29 UPROPERTY(BlueprintAssignable, Category="AI")
30 FOnAIStateChanged OnAIStateChangedDelegate;
31
32 UFUNCTION(BlueprintCallable, Category = "AI Reaction")
33 void SetAIState(const EAIStateType NewAIState);
34 UFUNCTION(BlueprintImplementableEvent, Category = "AI Reaction")
35 void OnAIStateChanged(EAIStateType NewAIState);
36
37 UFUNCTION(BlueprintCallable, Category = "AI")
38 void SetBlackboardComponent(UBlackboardComponent* Blackboard){BlackboardComponent = Blackboard;};
39
40 UFUNCTION(BlueprintCallable, Category = "AI")
41 void SetCanDetect(const bool bValue){bCanDetect = bValue;};
42
43 UFUNCTION(BlueprintCallable, BlueprintPure, Category = "AI Reaction")
44 EAIStateType GetCurrentAIState() const {return CurrentAIState;};
45
46 virtual void SetupComponentWidgets() override;
47 virtual void ComponentSetupComplete() override;
48
50 // UFUNCTION(BlueprintCallable, Category= "AI Traits")
51 // AActor* GetTargetActor() const{return TargetActor;};
52 UFUNCTION(BlueprintCallable, Category= "AI Traits")
53 AActor* GetCurrentTargetActor() const;
54 UFUNCTION(BlueprintCallable, Category= "AI Traits")
55 FHostileActorInfo& GetCurrentTargetActorInfo();
56
57 UFUNCTION(BlueprintCallable, Category= "AI Traits")
58 bool SetCurrentTargetActor(AActor* Target);
59
60 UFUNCTION(BlueprintCallable, Category = "AI Reaction")
61 void HeadInjury();
62
63 UFUNCTION(BlueprintCallable, Category = "Character")
64 void ActionReceived(AActor* Actor, const FAIStimulus& Stimulus);
65
66
67 UFUNCTION(BlueprintCallable, Category = "AI Reaction")
68 void TouchedByActor(AActor* Target, const FAIStimulus& Stimulus);
69
70 UFUNCTION(BlueprintCallable, Category = "AI Reaction")
71 void SightDetected(AActor* Target, const FAIStimulus& Stimulus);
72 UFUNCTION(BlueprintCallable, Category = "AI Reaction")
73 void SightDetectingCheck();
74 UFUNCTION(BlueprintCallable, Category = "AI Reaction")
75 void SightLost(AActor* Target, const FAIStimulus& Stimulus);
76
77 UFUNCTION(BlueprintCallable, Category = "AI Reaction")
78 void SightDetectedDecrease();
79
80 UFUNCTION(BlueprintCallable, Category = "AI Reaction")
81 void SoundDetected(AActor* Target, const FAIStimulus& Stimulus);
82 UFUNCTION(BlueprintCallable, Category = "AI Reaction")
83 void SoundDetectedDecrease();
84
85 UFUNCTION(BlueprintCallable, Category = "AI Reaction")
86 void TargetHostileFound(AActor* Hostile);
87
88 UFUNCTION(BlueprintCallable, Category = "AI Reaction")
89 void AlertNearbyFriendsOfHostile(AActor* Hostile);
90
92 UFUNCTION(BlueprintCallable, Category = "AI Reaction")
93 void DamagedActor(AActor* Actor, const float Damage);
94 UFUNCTION(BlueprintCallable, Category = "AI Reaction")
95 void KilledActor(AActor* Actor);
96
97
98
99 // UFUNCTION(BlueprintCallable, Category = "AI Reaction")
100 // void StartAlert();
101 // UFUNCTION(BlueprintCallable, Category = "AI Reaction")
102 // void StopAlert();
103
104 UFUNCTION(BlueprintCallable, Category = "AI Reaction")
105 void IncreaseAlert();
106
107 UFUNCTION(BlueprintCallable, Category = "AI Reaction")
108 void StartDetecting();
109
110 UFUNCTION(BlueprintCallable, Category = "AI Reaction")
111 void StopDetecting();
112 UFUNCTION(BlueprintCallable, Category = "AI Reaction")
113 void InstantDetection(AActor* Target);
114 UFUNCTION(BlueprintCallable, Category = "AI Reaction")
115 void StopInstantlyDetecting();
116
117 UFUNCTION(BlueprintCallable, Category = "AI Reaction")
118 void TargetDetected();
119 UFUNCTION(BlueprintImplementableEvent, Category = "AI Reaction")
120 void OnTargetDetected();
121
122
123 UFUNCTION(BlueprintCallable, Category = "AI Reaction")
124 void InvestigateTarget(AActor* Target);
125 UFUNCTION(BlueprintCallable, Category = "AI Reaction")
126 void InvestigateLastKnownLocation();
127 // UFUNCTION(BlueprintImplementableEvent, Category = "AI Reaction")
128 // void OnInvestigateTarget();
129
131 UFUNCTION(BlueprintCallable, Category = "Character")
132 void AddDetectionToActor(AActor* Target, const float DetectionToAdd);
133 // UFUNCTION(BlueprintCallable, Category = "Character")
134 // void AddDetectionToCurrentTarget(const float DetectionToAdd);
135
136 UFUNCTION(BlueprintCallable, Category = "Character")
137 void ClearDetectionToActor(AActor* Target);
138
143 UFUNCTION(BlueprintCallable, Category = "Character")
144 int32 AddActor(AActor* Actor);
145 UFUNCTION(BlueprintCallable, Category = "Character")
146 void DamagedTakenByActor(AActor* Actor, const float Damage = 10.0f);
147 UFUNCTION(BlueprintCallable, Category = "Character")
148 int32 RemoveActor(AActor* Actor);
149
150 UFUNCTION(BlueprintCallable, Category = "Character")
151 int32 GetKnownActorIndex(AActor* Actor);
152
153 UFUNCTION(BlueprintCallable, Category = "Character")
154 void SoundHeardAtLocation(const FVector& Location, const ESoundSource Source);
155
156 UFUNCTION(BlueprintPure, BlueprintCallable, Category = "Character")
157 AActor* GetBestHostileActor();
158 // UFUNCTION(BlueprintPure, BlueprintCallable, Category = "Character")
159 // FHostileActorInfo& GetBestHostileActorInfo() const;
160 UFUNCTION(BlueprintPure, BlueprintCallable, Category = "Character")
161 float GetVisibilityScore(AActor* Target);
162
163 //- Called when NPCs are doing actions such as Firing Weapon, or Meleeing and don't want to hit friendlies //
164 UFUNCTION(BlueprintCallable, Category = "Character")
165 void RequestFriendlyActors(TArray<AActor*>& Actors);
166 UFUNCTION(BlueprintPure, BlueprintCallable, Category = "Character")
167 TArray<AActor*> GetHostileActors() const;
168 // UFUNCTION(BlueprintPure, BlueprintCallable, Category = "Character")
169 // TArray<FHostileActorInfo> GetHostileActorsInfo() const;
170 // UFUNCTION(BlueprintPure, BlueprintCallable, Category = "Character")
171 // TArray<FHostileActorInfo>& GetAllKnownActorsInfo() const;
173 UFUNCTION(BlueprintPure, BlueprintCallable, Category = "Character")
174 TArray<FHostileActorInfo> GetAllKnownActorsInfo() const;
175
176
177 UFUNCTION(BlueprintPure, BlueprintCallable, Category = "Character")
178 float GetTotalAlertLevel() const;
179
180 UFUNCTION(BlueprintCallable, Category = "Character")
181 bool IsActorKnown(const AActor* Actor) const;
182 UFUNCTION(BlueprintCallable, Category = "Character")
183 bool IsActorDetected(AActor* Actor) const;
185 // UFUNCTION(BlueprintCallable, Category = "Character")
186 // bool IsActorCurrentDetectingActor(AActor* Actor);
188 UFUNCTION(BlueprintCallable, Category = "Character")
189 bool IsActorCurrentHostileActor(AActor* Actor);
190
191 UFUNCTION(BlueprintCallable, Category = "Character")
192 FHostileActorInfo& GetKnownActorInfo(AActor* Actor);
193
194 UFUNCTION(BlueprintCallable, BlueprintPure, Category = "AI Reaction")
195 float GetAccuracy() const{return CharacterEmotions.Accuracy;};
197 UFUNCTION(BlueprintCallable, BlueprintPure, Category = "AI Reaction")
198 float GetPredictionTime() const;
199
200 UFUNCTION(BlueprintCallable, BlueprintPure, Category = "AI Traits")
201 bool GetCanBeInteractedWith() const;
202
203
204 UFUNCTION(BlueprintCallable, BlueprintPure, Category = "AI Traits")
205 EFactionType GetFaction() const{return FactionType;};
206
207 //~ Character skills //
208 UFUNCTION(BlueprintCallable, BlueprintPure, Category = "AI Traits")
209 int32 GetStrength() const{return CharacterSkills.GetStrength();};
210 UFUNCTION(BlueprintCallable, BlueprintPure, Category = "AI Traits")
211 int32 GetPerception() const{return CharacterSkills.GetPerception();};
212 UFUNCTION(BlueprintCallable, BlueprintPure, Category = "AI Traits")
213 int32 GetEndurance() const{return CharacterSkills.GetEndurance();};
214 UFUNCTION(BlueprintCallable, BlueprintPure, Category = "AI Traits")
215 int32 GetCharisma() const{return CharacterSkills.GetCharisma();};
216 UFUNCTION(BlueprintCallable, BlueprintPure, Category = "AI Traits")
217 int32 GetIntelligence() const{return CharacterSkills.GetIntelligence();};
218 UFUNCTION(BlueprintCallable, BlueprintPure, Category = "AI Traits")
219 int32 GetAgility() const{return CharacterSkills.GetAgility();};
220 UFUNCTION(BlueprintCallable, BlueprintPure, Category = "AI Traits")
221 int32 GetWeaponSkill() const{return CharacterSkills.GetWeaponSkill();};
222 UFUNCTION(BlueprintCallable, BlueprintPure, Category = "AI Traits")
223 int32 GetStealth() const{return CharacterSkills.GetStealth();};
224 UFUNCTION(BlueprintCallable, BlueprintPure, Category = "AI Traits")
225 int32 GetLuck() const{return CharacterSkills.GetLuck();};
226 //@TODO Change to Get from Owner, and be able to Modify them from here;
227 UFUNCTION(BlueprintCallable, BlueprintPure, Category = "AI Traits")
228 virtual bool GetCharacterTraits(FCharacterBaseSkills& Skills) {Skills = CharacterSkills; return true;};
229 //~ Character skills //
230
231 UFUNCTION(BlueprintCallable, Category = "AI Traits")
232 float GetHearingRange() const;
233 UFUNCTION(BlueprintCallable, Category = "AI Traits")
234 float GetHearingMaxAge() const;
235 UFUNCTION(BlueprintCallable, Category = "AI Traits")
236 float GetSightRange() const;
237 UFUNCTION(BlueprintCallable, Category = "AI Traits")
238 float GetLoseSightRange() const;
239 UFUNCTION(BlueprintCallable, Category = "AI Traits")
240 float GetSightAngle() const;
241 UFUNCTION(BlueprintCallable, Category = "AI Traits")
242 float GetSightPOVBackwardsOffset() const;
243 UFUNCTION(BlueprintCallable, Category = "AI Traits")
244 float GetSightMaxAge() const;
245 UFUNCTION(BlueprintCallable, Category = "AI Traits")
246 float GetSightAutoDetectRange() const;
247
248
249 UFUNCTION(BlueprintCallable, Category = "AI Traits")
250 FCharacterEmotions GetCharacterEmotions() const {return CharacterEmotions;};
251
252
253 virtual void OwnerDeath() override;
254
255
256 UFUNCTION(BlueprintCallable, Category = "Companion")
257 void SetCompanionTargetEnemy(AActor* Target, const bool bValue = true);
258
259
260protected:
261 virtual void BeginPlay() override;
262 UFUNCTION()
263 virtual void TakeDamage(AActor* DamagedActor, float Damage, const UDamageType* DamageType, AController* InstigatedBy, AActor* DamageCauser);
264
265 virtual void OwnerKnockedOut(const UDamageType* DamageType) override;
266 virtual void OwnerWakeUp() override;
267
268 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="Character")
269 TArray<FHostileActorInfo> AllKnownActors;
270 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="Character")
271 int32 CurrentTargetActor = -1;
272 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="Character")
273 int32 CompanionTargetActor = -1;
274
275 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="Character")
276 int32 CurrentDetectingActor = -1;
277
278 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="AI Traits|Character")
279 TArray<FName> VisibilityTraceLocations = {FName("head"), FName("Pelvis"), FName("Foot_R"), FName("Foot_L"), FName("Hand_L"), FName("hand_r")};
280
281 UFUNCTION(BlueprintCallable, Category= "AI Traits|Alert Widget")
282 void SetAlertBarVisibility(const bool bVisible) const;
283
284 float GetDetectionSpeed(const struct FAIStimulus& Stimulus) const;
285
286 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="AI Traits|Alert Widget")
287 class UAlertWidgetComponent* AlertWidgetComponent = nullptr;
288 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Traits|Alert Widget")
289 bool bHasAlertBar = false;
290 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "AI Traits|Alert Widget")
291 float AlertBarScale = 0.3f;
292 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "AI Traits|Alert Widget")
293 float AlertBarZOffset = 130.0f;
294 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "AI Traits|Alert Widget")
295 FRotator AlertBarRotation = FRotator(0.0f,280.0f,0.0f);
296
297
298
299 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Traits|State")
300 bool bIsIdle = false;
301 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Traits|State")
302 bool bInCombat = false;
303 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Traits|State")
304 bool bHostile = false;
305 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Traits|State")
306 bool bIsCompanion = false;
307 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Traits|State")
308 EAIStateType CurrentAIState = EAIStateType::Default;
309
310 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Traits|Factions")
311 EFactionType FactionType = EFactionType::Alliance;
312
313
314 //- How Hard to Kill, Higher = more health, Shields + accuracy //
315 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Traits|Traits")
316 int32 DifficultyLevel = 1;
317 //- Rank Is for Groups Leaders = 10 follower = 5
318 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Traits|Traits")
319 int32 Rank = 1;
320 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Traits|Traits")
321 FCharacterBaseSkills CharacterSkills;
322
323 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Traits|Traits")
324 FCharacterEmotions CharacterEmotions;
325
326
327 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Traits|Traits")
328 float PushAggressiveAddition = 1.0f;
329 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Traits|Traits")
330 float PushHostilityAddition = 0.2f;
331
332 // Social
333 // Energy
334 // Happy
335
336 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Traits|Stun")
337 float StunDamageThreshold = 15.0f;
338 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Traits|Stun")
339 float StunWaitTime = 1.0f;
341 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Traits|Stun")
342 float StunDamageWaitTimeModifier = 100.0f;
343
344
345 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Traits|Patrol")
346 bool bIsOnPatrol = false;
347 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Traits|Patrol")
348 AActor* PatrolPathReference = nullptr;
349 //- How close should he walk to the exact point //
350 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Traits|Patrol")
351 float PathPointReachableRadius = 100.0f;
352 //- How close is considered reached //
353 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Traits|Patrol")
354 float PathPointAcceptanceRadius = 25.0f;
355 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="AI Traits|Patrol")
356 bool bPatrollingForward = true;
357
358 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Traits|Detection|Best Hostile")
359 float DetectionDistanceMin = 350.0f;
360 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Traits|Detection|Best Hostile")
361 float DistanceScoreMultiplier = 1.0f;
362 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Traits|Detection|Best Hostile")
363 float DamageScoreMultiplier = 1.0f;
364 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Traits|Detection|Best Hostile")
365 float HostilityScoreMultiplier = 1.0f;
366 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Traits|Detection|Best Hostile")
367 float VisibilityScoreMultiplier = 1.0f;
368
369
370
371 //- How Quickly the Detect function fires //
372 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Traits|Detection")
373 float DetectionSpeed = 0.1f;
374 //- How long after out of sight does the detection start to go down //
375 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Traits|Detection")
376 float LoseDetectionTime = 0.2f;
377 //- The Default of How Quickly After Hearing something does the Alert bar start to decrease //
378 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Traits|Detection|Hearing")
379 float LoseSoundDetectionTimeDefault = 1.0f;
380 //- How Quickly After Hearing something does the Alert bar start to decrease + the Sound Level //
381 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="AI Traits|Detection|Hearing")
382 float LoseSoundDetectionTime = 2.0f;
383
384 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="AI Traits|Detection|Hearing")
385 float InvestigateSoundDetectionTime = 10.0f;
386
387
388 //- The Default of How Quickly After Hearing something does the Alert bar start to decrease //
389 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Traits|Detection|Sight")
390 float LoseSightDetectionTimeDefault = 1.0f;
391 //- How Quickly After Hearing something does the Alert bar start to decrease + the Sound Level //
392 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="AI Traits|Detection|Sight")
393 float LoseSightDetectionTime = 2.0f;
394
395
396 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="AI Traits|Detection")
397 float AlertLevel = 0.0f;
398
399
400 //- How much the detection goes up each time //
401 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Traits|Detection")
402 float DetectionIncreaseAmountDefault = 0.01f;
403 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category="AI Traits|Detection")
404 float DetectionIncreaseAmount = 0.01f;
405 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Traits|Detection")
406 float DetectionLevelMax = 100.0f;
407 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Traits|Detection")
408 float DetectionLevelInvestigate = 30.0f;
409
411 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="AI Traits|Detection")
412 float SightDetectionFrequency = 0.1f;
413
414 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Traits|Detection|Sight")
415 float SightSpeedModifier = 0.2f; // Example: Increase detection speed by 50% of the strength
416
417 // UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Traits|Detection|Sight")
418 // float SightStrengthModifier = 25.0f; // Example: Increase detection speed by 50% of the strength
419 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Traits|Detection|Sight")
420 float SightDistanceModifier = 0.008f; // Example: Decrease detection speed by 2% per unit of distance
421 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Traits|Detection|Sight")
422 float SightAgeModifier = -0.1f; // Example: Decrease detection speed by 10% of the stimulus age
423 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Traits|Detection|Sight")
424 bool bUseSightAgeDetection = true;
425 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Traits|Detection|Sight")
426 bool bUseSightStrengthDetection = true;
427 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Traits|Detection|Sight")
428 bool bUseSightDistanceDetection = true;
429
430
431 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Traits|Detection|Hearing")
432 float SoundStrengthModifier = 25.0f; // Example: Increase detection speed by 50% of the strength
433 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Traits|Detection|Hearing")
434 float SoundDistanceModifier = 0.008f; // Example: Decrease detection speed by 2% per unit of distance
435 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Traits|Detection|Hearing")
436 float SoundAgeModifier = -0.1f; // Example: Decrease detection speed by 10% of the stimulus age
437 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Traits|Detection|Hearing")
438 bool bUseSoundAgeDetection = true;
439 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Traits|Detection|Hearing")
440 bool bUseSoundStrengthDetection = true;
441 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Traits|Detection|Hearing")
442 bool bUseSoundDistanceDetection = true;
443
445 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Traits|Detection|Hearing")
446 float HearingStrengthInstantIgnore = 1.5f;
447 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Traits|Detection|Hearing")
448 float HearingDistanceInstantDetect = 500.0f;
449 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Traits|Detection|Hearing")
450 float HearingWeaponMultiplier = 3.0f;
451 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Traits|Detection|Hearing")
452 float HearingWhileHostileIgnore = 2.0f;
453
454 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Traits|Detection|Hearing")
455 float HearingLevelWakeup = 1.5f;
457 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Traits|Detection|Hearing")
458 float HearingSilencedBulletDistance =250.0f;
459
460 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Traits|Detection|Hearing")
461 float HearingRangeMax = 4000.0f;
462 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Traits|Detection|Hearing")
463 float HearingRangeMin = 1500.0f;
464 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Traits|Detection|Hearing")
465 float HearingMaxAgeMax = 15.0f;
466 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Traits|Detection|Hearing")
467 float HearingMaxAgeMin = 1.0f;
468
469 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Traits|Detection|Sight")
470 float SightRangeMax = 5000.0f;
471 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Traits|Detection|Sight")
472 float SightRangeMin = 2000.0f;
473 //- How much is added to the sight Range //
474 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Traits|Detection|Sight")
475 float LoseSightRangeDifference = 500.0f;
476
477 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Traits|Detection|Sight")
478 float SightAngleMax = 135.0f;
479 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Traits|Detection|Sight")
480 float SightAngleMin = 80.0f;
481 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Traits|Detection|Sight")
482 float SightPOVBackwardOffsetMax = 50.0f;
483 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Traits|Detection|Sight")
484 float SightPOVBackwardOffsetMin = 0.0f;
485 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Traits|Detection|Sight")
486 float SightMaxAgeMax = 15.0f;
487 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Traits|Detection|Sight")
488 float SightMaxAgeMin = 1.0f;
489
490 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Traits|Detection|Sight")
491 float SightAutoSuccessRangeMax = 350.0f;
492 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Traits|Detection|Sight")
493 float SightAutoSuccessRangeMin = 100.0f;
494 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="AI Traits|Detection|Sight")
495 float SightAutoSuccessRangeNonHostile = 75.0f;
496
497 bool bDecrease = false;
498
499 void CheckHostileIsPerceived();
500
501private:
502 void UpdateAlertLevel();
503
504 IAIActionsInterface* GetControllerActions() const;
505
506
507 // UPROPERTY()
508 // AActor* TargetActor = nullptr;
509 bool bDetecting = false;
510 bool bCanDetect = true;
511 float TargetActorDetectionLevel = 0.0f;
512
513 UPROPERTY()
514 UBlackboardComponent* BlackboardComponent;
515
516 void DetectingActor();
517
518 UPROPERTY(EditDefaultsOnly, Category="AI Traits|Detection|Hostile")
519 float CheckHostilePerceivedFrequency = 2.0f;
520
521
522
523 //- Move into Struct?
524 FTimerHandle DetectingTimerHandle;
525 FTimerHandle AlertIncreaseTimerHandle;
526 FTimerHandle AlertDecreaseTimerHandle;
527
528 FTimerHandle SightDetectionTimerHandle;
529
530 FTimerHandle HearingDetectionTimerHandle;
531 FTimerHandle HostileCheckTimerHandle;
532 FTimerHandle AlertCheckTimerHandle;
533
534 FVector NextMoveToLocation = FVector::ZeroVector;
535 FVector LastSeenEnemyLocation = FVector::ZeroVector;
536
537 int32 PatrolPointsMovedTo = 0;
538 // void NotifyNearbyFriends();
539 UPROPERTY(EditAnywhere, Category = "Health")
540 TSubclassOf<class UAlertWidgetComponent> AlertWidgetComponentClass;
541
542
543 FHostileActorInfo Empty = FHostileActorInfo::Empty();
544 EAIStateType PreviousState = EAIStateType::Default;
545};
EAIStateType
Definition AIDataTypes.h:121
EFactionType
Definition AIDataTypes.h:103
DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnAlertLevelChanged, float, DetectionLevel, EAIStateType, AIStateType, AActor *, TargetActor)
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnAIStateChanged, EAIStateType, State)
ESoundSource
Definition BaseData.h:73
UCLASS(Blueprintable, BlueprintType, ClassGroup=(BucciGames), meta=(BlueprintSpawnableComponent)) class CHATSYSTEM_API UChatSystemComponent
Definition ChatSystemComponent.h:13
Definition Health.Build.cs:6
Definition AIActionsInterface.h:20
Represents a character component that can be added to an actor.
Definition BaseData.h:815
Definition AIDataTypes.h:359
Definition AIDataTypes.h:385