Mortar Pro Plugin  Version 2
Modular Turret Plugin
All Classes Namespaces Functions Variables Enumerations Enumerator Pages
AMortarProAIController Class Reference

#include <MortarProAIController.h>

+ Inheritance diagram for AMortarProAIController:
+ Collaboration diagram for AMortarProAIController:

Public Member Functions

 AMortarProAIController ()
 
FName GetEnemyKey () const
 
bool GetShouldTargetEnemies () const
 
bool GetShouldTargetFriends () const
 
bool GetShouldTargetNeutrals () const
 
ETeamAttitude::Type GetTeamAttitudeTowards (const AActor &Other) const override
 
bool IsValidTarget (const AActor *Target)
 
void SetEnemyKey (const FName &Key)
 
void SetShouldTargetEnemies (const bool &bSelect)
 
void SetShouldTargetFriends (const bool &bSelect)
 
void SetShouldTargetNeutrals (const bool &bSelect)
 

Protected Member Functions

void GetBestTarget (TArray< AActor * > &OutDetectedActors)
 
virtual void GetBestTarget_Implementation (TArray< AActor * > &OutDetectedActors)
 
void Tick (float DeltaSeconds) override
 

Protected Attributes

class UAIPerceptionComponent * AIPerception
 
UBehaviorTree * BehaviorTree
 
UBlackboardComponent * BlackboardComponent
 
UBlackboardData * BlackboardData
 

Private Member Functions

virtual void BeginPlay () override
 
void DrawTextAtDetectedTargets (TArray< AActor * > &TargetActors)
 
void FilterTargetActors (TArray< AActor * > &OutFilteredActors)
 
void OnDeathDelegate ()
 
void OnPauseDelegate ()
 
void OnResumeDelegate ()
 
void OnTeamChanged (FMortarProTeamProperties PreviousTeam, FMortarProTeamProperties CurrentTeam)
 
virtual void SenseAllActors (const TArray< AActor * > &ActorsDetected)
 
virtual void SetPawn (APawn *InPawn) override
 

Private Attributes

class UMortarProActorsObjectActorsObject
 
uint32 bTargetEnemy: 1
 
uint32 bTargetFriends: 1
 
uint32 bTargetNeutrals: 1
 
FName EnemyKey = "DetectedEnemies"
 
class UAISenseConfig_Hearing * HearingConfig { nullptr }
 
class AMortarProPawnMortarProPawnRef { nullptr }
 
FGenericTeamId OwnerTeamID
 
class UAISenseConfig_Sight * SightConfig { nullptr }
 
TArray< AActor * > TargetActors
 

Detailed Description

AI Controller Class . Mind Of AI contains logic for detecting actors using AI Perception

Constructor & Destructor Documentation

◆ AMortarProAIController()

AMortarProAIController::AMortarProAIController ( )

Member Function Documentation

◆ BeginPlay()

virtual void AMortarProAIController::BeginPlay ( )
overrideprivatevirtual

Event Called in beg

◆ DrawTextAtDetectedTargets()

void AMortarProAIController::DrawTextAtDetectedTargets ( TArray< AActor * > &  TargetActors)
private

Draws Debug Text At Detected Targets.

Parameters
[in]TargetActorsTArray containing actors sorted according to priority

◆ FilterTargetActors()

void AMortarProAIController::FilterTargetActors ( TArray< AActor * > &  OutFilteredActors)
private

This will filter and select those actors only which are target of current actors If we select friends as target then this function will return only friends target If we select enemy target then this will return enemy target only

Parameters
[out]OutFilteredActorsTarray of Actors which are filtered means actors that needs to be targetd. We initially pass detected actors

◆ GetBestTarget()

void AMortarProAIController::GetBestTarget ( TArray< AActor * > &  OutDetectedActors)
protected

This Returns Array which is sorted according to some condition could be distance etc This Function is Blueprint Native Event Allowing User to override the functionality in Blueprints

Parameters
[out]OutDetectedActorsTarray of Actors Detected by AI. This will sort The detected actors

◆ GetBestTarget_Implementation()

virtual void AMortarProAIController::GetBestTarget_Implementation ( TArray< AActor * > &  OutDetectedActors)
protectedvirtual

◆ GetEnemyKey()

FName AMortarProAIController::GetEnemyKey ( ) const

Getter Function To get the name of key that will be used in Blackboard

Returns
Name of Key as FName

◆ GetShouldTargetEnemies()

bool AMortarProAIController::GetShouldTargetEnemies ( ) const

Getter Function To get whether to select enemy as target in behavior tree or not

Returns
Boolean flag denoting whether to select enemy or not

◆ GetShouldTargetFriends()

bool AMortarProAIController::GetShouldTargetFriends ( ) const

Getter Function To get whether to select Friends as target in behavior tree or not

Returns
Boolean flag denoting whether to select friends or not

◆ GetShouldTargetNeutrals()

bool AMortarProAIController::GetShouldTargetNeutrals ( ) const

Getter Function To get whether to select Neutrals as target in behavior tree or not

Returns
Boolean flag denoting whether to select Neutrals or not

◆ GetTeamAttitudeTowards()

ETeamAttitude::Type AMortarProAIController::GetTeamAttitudeTowards ( const AActor &  Other) const
override

Returns Behavior our AI Pawn towards a detected pawn

Parameters
[in]OtherActor for which we want to evaluate attitude towards
Returns
Attitude of Current owner towards Other

◆ IsValidTarget()

bool AMortarProAIController::IsValidTarget ( const AActor *  Target)

Returns whether actor passed is target or not.Target depends on flags bShouldTarget Enemies/NEutrals/Friends. If we select target friends then in the case friends will be enemies :(

Parameters
[in]TargetActor for which we will check whether it is valid or not
Returns
True if target found False otherwise

◆ OnDeathDelegate()

void AMortarProAIController::OnDeathDelegate ( )
private

Event Called On Death. Here we generally like to disconnect Controller which then can be deleted

◆ OnPauseDelegate()

void AMortarProAIController::OnPauseDelegate ( )
private

Event Called When AI Dies and in future would want to resume

◆ OnResumeDelegate()

void AMortarProAIController::OnResumeDelegate ( )
private

Event Called When AI Respawns after Death

◆ OnTeamChanged()

void AMortarProAIController::OnTeamChanged ( FMortarProTeamProperties  PreviousTeam,
FMortarProTeamProperties  CurrentTeam 
)
private

Callback Function When Team is changed

Parameters
[in]PreviousTeamDetails of Previous Team
[in]CurrentTeamDetails of Current Team

◆ SenseAllActors()

virtual void AMortarProAIController::SenseAllActors ( const TArray< AActor * > &  ActorsDetected)
privatevirtual

Function to be called on Perception Updation

Parameters
[in]ActorsDetectedTarray of Actors Detected by AI

◆ SetEnemyKey()

void AMortarProAIController::SetEnemyKey ( const FName &  Key)

This function sets the name of key that will be used in Blackboard

Parameters
[in]KeyName of key that will be used in blackboard

◆ SetPawn()

virtual void AMortarProAIController::SetPawn ( APawn *  InPawn)
overrideprivatevirtual

Sets Pawn and Register for events

Parameters
[in]InPawnPawn to set

◆ SetShouldTargetEnemies()

void AMortarProAIController::SetShouldTargetEnemies ( const bool &  bSelect)

This function sets whether to choose enemy as target in behavior tree or not

Parameters
[in]bSelectBoolean flag whether to select enemy or not

◆ SetShouldTargetFriends()

void AMortarProAIController::SetShouldTargetFriends ( const bool &  bSelect)

This function sets whether to choose Friends as target in behavior tree or not

Parameters
[in]bSelectBoolean flag whether to select Friends or not

◆ SetShouldTargetNeutrals()

void AMortarProAIController::SetShouldTargetNeutrals ( const bool &  bSelect)

This function sets whether to choose Neutrals as target in behavior tree or not

Parameters
[in]bSelectBoolean flag whether to select Neutrals or not

◆ Tick()

void AMortarProAIController::Tick ( float  DeltaSeconds)
overrideprotected

Tick Function

Member Data Documentation

◆ ActorsObject

class UMortarProActorsObject* AMortarProAIController::ActorsObject
private

Pointer To actors Object containing detected actors to be used in blackboard

◆ AIPerception

class UAIPerceptionComponent* AMortarProAIController::AIPerception
protected

AI Perception Event for detecting senses

◆ BehaviorTree

UBehaviorTree* AMortarProAIController::BehaviorTree
protected

Behavior Tree to run that will be setup in Blueprint

◆ BlackboardComponent

UBlackboardComponent* AMortarProAIController::BlackboardComponent
protected

Contains Blackboard all keys

◆ BlackboardData

UBlackboardData* AMortarProAIController::BlackboardData
protected

Blackboard to use Path Has to be setup in blueprint

◆ bTargetEnemy

uint32 AMortarProAIController::bTargetEnemy
private

Whether to Select Enemies i.e with diff team id . Detection by Affilation should be configured accordingly in AI Controller

◆ bTargetFriends

uint32 AMortarProAIController::bTargetFriends
private

Whether to Select Members of same team id . Detection by Affilation should be configured accordingly in AI Controller

◆ bTargetNeutrals

uint32 AMortarProAIController::bTargetNeutrals
private

Whether to Select Neutral Members i.e. of team id = 0. Detection by Affilation should be configured accordingly in AI Controller

◆ EnemyKey

FName AMortarProAIController::EnemyKey = "DetectedEnemies"
private

Key Name That Will be set in BehaviorTree By this keyname ai controller will set the values which will be later used Change Carefully need to change in behavior tree also

◆ HearingConfig

class UAISenseConfig_Hearing* AMortarProAIController::HearingConfig { nullptr }
private

Hearing Sense

◆ MortarProPawnRef

class AMortarProPawn* AMortarProAIController::MortarProPawnRef { nullptr }
private

Reference to Owner

◆ OwnerTeamID

FGenericTeamId AMortarProAIController::OwnerTeamID
private

Team ID of the owner of this AI Controller

◆ SightConfig

class UAISenseConfig_Sight* AMortarProAIController::SightConfig { nullptr }
private

Sight Sense. This is the dominant sense. we are having two senses only can add more from blueprint and also can change existing settings from there

◆ TargetActors

TArray<AActor*> AMortarProAIController::TargetActors
private

Contains Reference To Target Actors detected view AI perception and are valid targets


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