Space Plunder
Loading...
Searching...
No Matches
FHostileActorInfo Struct Reference

#include <AIDataTypes.h>

Public Member Functions

 FHostileActorInfo ()
 
 FHostileActorInfo (AActor *Actor)
 
 FHostileActorInfo (AActor *Actor, const FFactionRelationship &Relationship)
 
void AddDamageReceivedByOwner (const float Value)
 
void AddDamageDealtToOwner (const float Value)
 
void AddHostility (const float Value)
 
void AddVisibility (const float Value)
 
void AddDetection (const float Value, const float MaxDetection, const float InvestigateDetection)
 
void LostSightOnTarget ()
 
void LostTarget (const float InvestigateDetection)
 
void ClearDetection ()
 
bool operator== (const FHostileActorInfo &Other) const
 
bool IsValid () const
 
bool IsHostile () const
 
bool IsFriendly () const
 
bool IsAllied () const
 
bool IsNeutral () const
 
ERelationshipStatus GetRelationshipStatus () const
 
FVector GetLocation () const
 

Static Public Member Functions

static FHostileActorInfo Empty ()
 

Public Attributes

AActor * HostileActor = nullptr
 
FVector LastSeenLocation = FVector::ZeroVector
 
float DetectionLevel = 0.0f
 
bool bDetected = false
 
bool bInvestigate = false
 
bool bDead = false
 
float DamageReceivedByOwner = 0.0f
 
float DamageDealtToOwner = 0.0f
 
float VisibilityScore = 0.0f
 
float TotalScore = 0.0f
 
float TrustScore = 0.0f
 
float HostilityScore = 100.0f
 
float TrustDecreaseFactor = 10.0f
 
float HostilityIncreaseFactor = 0.2f
 

Constructor & Destructor Documentation

◆ FHostileActorInfo() [1/3]

FHostileActorInfo::FHostileActorInfo ( )
inline
426 {
427
428 };

◆ FHostileActorInfo() [2/3]

FHostileActorInfo::FHostileActorInfo ( AActor * Actor)
inlineexplicit
430 {
431 HostileActor = Actor;
432 };
AActor * HostileActor
Definition AIDataTypes.h:389

◆ FHostileActorInfo() [3/3]

FHostileActorInfo::FHostileActorInfo ( AActor * Actor,
const FFactionRelationship & Relationship )
inlineexplicit
434 {
435 HostileActor = Actor;
436 TrustScore = Relationship.TrustLevel;
437 HostilityScore = Relationship.HostilityLevel;
438 };
float HostilityLevel
Definition AIDataTypes.h:294
float TrustLevel
Definition AIDataTypes.h:291
float TrustScore
Definition AIDataTypes.h:416
float HostilityScore
Definition AIDataTypes.h:418

Member Function Documentation

◆ AddDamageDealtToOwner()

void FHostileActorInfo::AddDamageDealtToOwner ( const float Value)
inline
450 {
451 DamageDealtToOwner += Value;
452
453 // if(!bDetected)
454 // {
455 // AddDetection(Value, MaxDetection, InvestigateDetection);
456 // }
457
458 //- @TODO Figure out formula for trust changing //
461 // / (abs(TrustScore) / 100.0f)
462
463 //- Scales, moves slower around 100 and -100 //
464 // const float TrustFactor = abs(MaxTrust / (TrustScore + 0.1f));
465 // FMath::Clamp(TrustFactor, 0.0, 0.0);
466
467
468
469 // const float DecreaseScore = abs(TrustDecreaseFactor * (MaxTrust / (TrustScore + 0.1)) * DamageDealt);
470 // TrustScore -= (DecreaseScore * Value);
471
472
473
474 //- Max Trust = 100.0f
475 // TrustScore = (0.1f + (MaxTrust - TrustScore) / TrustDecreaseFactor) * DamageDealt;
476 }
float DamageDealtToOwner
Definition AIDataTypes.h:409
float HostilityIncreaseFactor
Definition AIDataTypes.h:423
float TrustDecreaseFactor
Definition AIDataTypes.h:421

◆ AddDamageReceivedByOwner()

void FHostileActorInfo::AddDamageReceivedByOwner ( const float Value)
inline
442 {
443 DamageReceivedByOwner += Value;
444 //@TODO current doesn't do anything.
445 }
float DamageReceivedByOwner
Definition AIDataTypes.h:405

◆ AddDetection()

void FHostileActorInfo::AddDetection ( const float Value,
const float MaxDetection,
const float InvestigateDetection )
inline
487 {
488 DetectionLevel += Value;
489 if(DetectionLevel >= InvestigateDetection)
490 {
491 bInvestigate = true;
492 }
493 if(DetectionLevel >= MaxDetection)
494 {
495 bDetected = true;
496 }
497 if(DetectionLevel < 0.0f)
498 {
499 DetectionLevel = 0.0f;
500 }
501 //- Only Save on Increase //
502 if(Value >= 0 && HostileActor != nullptr)
503 {
504 LastSeenLocation = HostileActor->GetActorLocation();
505 }
506 }
FVector LastSeenLocation
Definition AIDataTypes.h:391
bool bInvestigate
Definition AIDataTypes.h:398
bool bDetected
Definition AIDataTypes.h:396
float DetectionLevel
Definition AIDataTypes.h:394

◆ AddHostility()

void FHostileActorInfo::AddHostility ( const float Value)
inline
478 {
479 HostilityScore += Value;
480 }

◆ AddVisibility()

void FHostileActorInfo::AddVisibility ( const float Value)
inline
483 {
484 VisibilityScore += Value;
485 }
float VisibilityScore
Definition AIDataTypes.h:411

◆ ClearDetection()

void FHostileActorInfo::ClearDetection ( )
inline
520 {
521 DetectionLevel = 0.0f;
522 bInvestigate = false;
523 bDetected = false;
524 }

◆ Empty()

static FHostileActorInfo FHostileActorInfo::Empty ( )
inlinestatic
528 {
529 const FHostileActorInfo EmptyData;
530 return EmptyData;
531 }
Definition AIDataTypes.h:385

◆ GetLocation()

FVector FHostileActorInfo::GetLocation ( ) const
inline
582 {
583 if(HostileActor == nullptr && !LastSeenLocation.IsNearlyZero()){return LastSeenLocation;}
584 if(HostileActor == nullptr){return FVector::ZeroVector;}
585 return HostileActor->GetActorLocation();
586 }

◆ GetRelationshipStatus()

ERelationshipStatus FHostileActorInfo::GetRelationshipStatus ( ) const
inline
577 {
579 }
static ERelationshipStatus GetRelationship(const float TrustLevel, const float HostilityLevel)
Definition AIDataTypes.h:169

◆ IsAllied()

bool FHostileActorInfo::IsAllied ( ) const
inline
560 {
561 if(TrustScore >= 40.0f && HostilityScore <= 20.0f)
562 {
563 return true;
564 }
565 return false;
566 }

◆ IsFriendly()

bool FHostileActorInfo::IsFriendly ( ) const
inline
552 {
554 {
555 return true;
556 }
557 return false;
558 }
float HostilityLevelFriendly
Definition AIDataTypes.h:20
float TrustLevelFriendly
Definition AIDataTypes.h:18

◆ IsHostile()

bool FHostileActorInfo::IsHostile ( ) const
inline
544 {
546 {
547 return true;
548 }
549 return false;
550 }
float HostilityLevelHostile
Definition AIDataTypes.h:35

◆ IsNeutral()

bool FHostileActorInfo::IsNeutral ( ) const
inline
568 {
569 if(TrustScore <= 0.0f && HostilityScore >= 40.0f)
570 {
571 return true;
572 }
573 return false;
574 }

◆ IsValid()

bool FHostileActorInfo::IsValid ( ) const
inline
Returns
if Hostile Actor is Set
539 {
540 return HostileActor != nullptr;
541 }

◆ LostSightOnTarget()

void FHostileActorInfo::LostSightOnTarget ( )
inline
508 {
509 if(HostileActor == nullptr){return;}
510 LastSeenLocation = HostileActor->GetActorLocation();
511 }

◆ LostTarget()

void FHostileActorInfo::LostTarget ( const float InvestigateDetection)
inline
514 {
515 DetectionLevel = InvestigateDetection;
516 bInvestigate = true;
517 }

◆ operator==()

bool FHostileActorInfo::operator== ( const FHostileActorInfo & Other) const
inline
533 {
534 return HostileActor == Other.HostileActor;
535 }

Member Data Documentation

◆ bDead

bool FHostileActorInfo::bDead = false

◆ bDetected

bool FHostileActorInfo::bDetected = false

◆ bInvestigate

bool FHostileActorInfo::bInvestigate = false

◆ DamageDealtToOwner

float FHostileActorInfo::DamageDealtToOwner = 0.0f

Damage Dealt to Owner

◆ DamageReceivedByOwner

float FHostileActorInfo::DamageReceivedByOwner = 0.0f

Damage Owner has done to this Character

◆ DetectionLevel

float FHostileActorInfo::DetectionLevel = 0.0f

◆ HostileActor

AActor* FHostileActorInfo::HostileActor = nullptr

◆ HostilityIncreaseFactor

float FHostileActorInfo::HostilityIncreaseFactor = 0.2f

◆ HostilityScore

float FHostileActorInfo::HostilityScore = 100.0f

◆ LastSeenLocation

FVector FHostileActorInfo::LastSeenLocation = FVector::ZeroVector

◆ TotalScore

float FHostileActorInfo::TotalScore = 0.0f

◆ TrustDecreaseFactor

float FHostileActorInfo::TrustDecreaseFactor = 10.0f

◆ TrustScore

float FHostileActorInfo::TrustScore = 0.0f

◆ VisibilityScore

float FHostileActorInfo::VisibilityScore = 0.0f

The documentation for this struct was generated from the following file: