(C++)  1.1.0
A multi-platform, modular, universal engine for embedding advanced AI in games.
grail::AIEntity Class Reference

The AIEntity class - Defines a basic object which can execute behaviors. More...

#include <AIEntity.hh>

Collaboration diagram for grail::AIEntity:

Public Member Functions

 AIEntity (const std::string &name="")
 
 AIEntity (const AIEntity &)=delete
 
 AIEntity (AIEntity &&)=delete
 
AIEntityoperator= (const AIEntity &)=delete
 
AIEntityoperator= (AIEntity &&)=delete
 
void SetReasoner (std::unique_ptr< Reasoner > newReasoner)
 SetReasoner. More...
 
const BehaviorGetCurrentBehavior () const
 GetCurrentBehavior. More...
 
BehaviorGetCurrentBehavior ()
 GetCurrentBehavior. More...
 
std::unique_ptr< BehaviorGetUniqueCurrentBehavior ()
 GetUniqueCurrentBehavior. More...
 
std::unique_ptr< BehaviorMoveSuspendedBehavior ()
 GetPreviousBehavior. More...
 
std::unique_ptr< Reasoner > & GetCurrentReasoner ()
 GetCurrentReasoner. More...
 
void StageBehavior (std::unique_ptr< Behavior > behavior)
 SetNewBehavior - Finishes current behavior and starts new one. More...
 
bool HasStagedBehavior () const
 HasStagedBehavior - checks whether this entity has behavior awaiting its execution. More...
 
bool HasActiveBehavior () const
 HasActiveBehavior - Checks whether current behavior is not nullptr. More...
 
void AddSharedBlackboard (const std::string &name, std::shared_ptr< Blackboard > &sharedBlackboard)
 AddSharedBlackboard - Inserts pair of key and blackboard into container of shared blackboards. More...
 
std::shared_ptr< BlackboardGetSharedBlackboard (const std::string &name) const
 GetSharedBlackboard - Gets shared blackboard identified by given key. More...
 
BlackboardGetBlackboard ()
 GetBlackboard. More...
 
const BlackboardGetBlackboard () const
 GetBlackboard. More...
 
void AddReasonerChangeObserver (IReasonerChangeObserver *observer)
 
void RemoveReasonerChangeObserver (IReasonerChangeObserver *observer)
 
void SetId (size_t id)
 
size_t GetId () const
 
const std::string & GetName () const
 
std::string GetCurrentBehaviorName () const
 

Protected Member Functions

virtual void Update (float deltaTime)
 Update - User defined method. Should in some way update entity's state. More...
 

Protected Attributes

std::unique_ptr< Reasonerreasoner
 
std::map< std::string, std::shared_ptr< Blackboard > > sharedBlackboards {}
 

Friends

class AIManager
 
class SynchronizedEntityContainer
 

Detailed Description

The AIEntity class - Defines a basic object which can execute behaviors.

Member Function Documentation

◆ AddSharedBlackboard()

void grail::AIEntity::AddSharedBlackboard ( const std::string &  name,
std::shared_ptr< Blackboard > &  sharedBlackboard 
)

AddSharedBlackboard - Inserts pair of key and blackboard into container of shared blackboards.

Parameters
name
sharedBlackboard

◆ GetBlackboard() [1/2]

Blackboard & grail::AIEntity::GetBlackboard ( )

GetBlackboard.

Returns
blackboard owned by this entity

◆ GetBlackboard() [2/2]

const Blackboard & grail::AIEntity::GetBlackboard ( ) const

GetBlackboard.

Returns
blackboard owned by this entity

◆ GetCurrentBehavior() [1/2]

Behavior * grail::AIEntity::GetCurrentBehavior ( )

GetCurrentBehavior.

Returns
pointer to currently assigned behavior

◆ GetCurrentBehavior() [2/2]

const Behavior * grail::AIEntity::GetCurrentBehavior ( ) const

GetCurrentBehavior.

Returns
pointer to const currently assigned behavior

◆ GetCurrentReasoner()

std::unique_ptr< Reasoner > & grail::AIEntity::GetCurrentReasoner ( )

GetCurrentReasoner.

Returns
current reasoner

◆ GetSharedBlackboard()

std::shared_ptr< Blackboard > grail::AIEntity::GetSharedBlackboard ( const std::string &  name) const

GetSharedBlackboard - Gets shared blackboard identified by given key.

Parameters
name
Returns
pointer to shared blackboard, nullptr if key is not found

◆ GetUniqueCurrentBehavior()

std::unique_ptr< Behavior > grail::AIEntity::GetUniqueCurrentBehavior ( )

GetUniqueCurrentBehavior.

Returns
unique pointer to currently assigned behavior

◆ HasActiveBehavior()

bool grail::AIEntity::HasActiveBehavior ( ) const

HasActiveBehavior - Checks whether current behavior is not nullptr.

Returns
false if nullptr, true otherwise

◆ HasStagedBehavior()

bool grail::AIEntity::HasStagedBehavior ( ) const

HasStagedBehavior - checks whether this entity has behavior awaiting its execution.

Returns
true if there is staged behavior, false if there isn't

◆ MoveSuspendedBehavior()

std::unique_ptr< Behavior > grail::AIEntity::MoveSuspendedBehavior ( )

GetPreviousBehavior.

Returns
raw pointer to previously assigned behavior

◆ SetReasoner()

void grail::AIEntity::SetReasoner ( std::unique_ptr< Reasoner newReasoner)

SetReasoner.

Parameters
reasoner

◆ StageBehavior()

void grail::AIEntity::StageBehavior ( std::unique_ptr< Behavior behavior)

SetNewBehavior - Finishes current behavior and starts new one.

Parameters
behavior

◆ Update()

void grail::AIEntity::Update ( float  deltaTime)
protectedvirtual

Update - User defined method. Should in some way update entity's state.

Parameters
deltaTime

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