Grail (C++)
1.4.0
A multi-platform, modular, universal engine for embedding advanced AI in games.
|
The AIEntity class - Defines a basic object which can execute behaviors. More...
#include <AIEntity.hh>
Public Member Functions | |
AIEntity (const std::string &name="") | |
AIEntity - Constructs an AIEntity with the given name. More... | |
AIEntity (const AIEntity &)=delete | |
AIEntity (AIEntity &&)=delete | |
AIEntity & | operator= (const AIEntity &)=delete |
AIEntity & | operator= (AIEntity &&)=delete |
void | SetReasoner (std::unique_ptr< Reasoner > newReasoner) |
SetReasoner. More... | |
const Behavior * | GetCurrentBehavior () const |
GetCurrentBehavior. More... | |
Behavior * | GetCurrentBehavior () |
GetCurrentBehavior. More... | |
std::unique_ptr< Behavior > | GetUniqueCurrentBehavior () |
GetUniqueCurrentBehavior. More... | |
std::unique_ptr< Behavior > | MoveSuspendedBehavior () |
GetPreviousBehavior. More... | |
std::unique_ptr< Reasoner > | TakeOwnershipOfReasoner () |
GetCurrentReasoner. More... | |
Reasoner * | GetReasoner () |
void | StageBehavior (std::unique_ptr< Behavior > behavior) |
StageBehavior - Finishes the current behavior and starts a 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... | |
void | RemoveSharedBlackboard (const std::string &name) |
RemoveSharedBlackboard - Removes shared blackboard entry. More... | |
std::shared_ptr< Blackboard > | GetSharedBlackboard (const std::string &name) const |
GetSharedBlackboard - Gets shared blackboard identified by given key. More... | |
Blackboard & | GetBlackboard () |
GetBlackboard. More... | |
const Blackboard & | GetBlackboard () const |
GetBlackboard. More... | |
void | AddReasonerChangeObserver (IReasonerChangeObserver *observer) |
AddReasonerChangeObserver - Adds a reasoner change observer that will be notified via calling OnReasonerSet function when a new reasoner is assigned to entity. More... | |
void | RemoveReasonerChangeObserver (IReasonerChangeObserver *observer) |
RemoveReasonerChangeObserver - Removes a reasoner change observer so it won't be notified of reasoner changes anymore. More... | |
void | SetId (size_t id) |
size_t | GetId () const |
const std::string & | GetName () const |
std::string | GetCurrentBehaviorName () const |
Static Public Member Functions | |
static void | ResetNextID (const size_t nextId=0) |
ResetNextID - Resets taken entity IDs. Useful when a game has ended but entities were not destroyed, like ending play in editor or soft resetting a level. More... | |
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< Reasoner > | reasoner |
std::map< std::string, std::shared_ptr< Blackboard > > | sharedBlackboards {} |
Friends | |
class | AIManager |
class | GrailStateSnapshotGenerator |
class | EntityToken |
The AIEntity class - Defines a basic object which can execute behaviors.
grail::AIEntity::AIEntity | ( | const std::string & | name = "" | ) |
void grail::AIEntity::AddReasonerChangeObserver | ( | IReasonerChangeObserver * | observer | ) |
AddReasonerChangeObserver - Adds a reasoner change observer that will be notified via calling OnReasonerSet function when a new reasoner is assigned to entity.
observer |
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.
name | |
sharedBlackboard |
const Blackboard & grail::AIEntity::GetBlackboard | ( | ) |
GetBlackboard.
const Blackboard& grail::AIEntity::GetBlackboard | ( | ) | const |
GetBlackboard.
Behavior* grail::AIEntity::GetCurrentBehavior | ( | ) |
GetCurrentBehavior.
Behavior * grail::AIEntity::GetCurrentBehavior | ( | ) | const |
GetCurrentBehavior.
std::shared_ptr< Blackboard > grail::AIEntity::GetSharedBlackboard | ( | const std::string & | name | ) | const |
GetSharedBlackboard - Gets shared blackboard identified by given key.
name |
std::unique_ptr< Behavior > grail::AIEntity::GetUniqueCurrentBehavior | ( | ) |
GetUniqueCurrentBehavior.
bool grail::AIEntity::HasActiveBehavior | ( | ) | const |
HasActiveBehavior - Checks whether current behavior is not nullptr.
bool grail::AIEntity::HasStagedBehavior | ( | ) | const |
HasStagedBehavior - checks whether this entity has behavior awaiting its execution.
std::unique_ptr< Behavior > grail::AIEntity::MoveSuspendedBehavior | ( | ) |
GetPreviousBehavior.
void grail::AIEntity::RemoveReasonerChangeObserver | ( | IReasonerChangeObserver * | observer | ) |
RemoveReasonerChangeObserver - Removes a reasoner change observer so it won't be notified of reasoner changes anymore.
observer |
void grail::AIEntity::RemoveSharedBlackboard | ( | const std::string & | name | ) |
RemoveSharedBlackboard - Removes shared blackboard entry.
name | - removed blackboard's name |
|
static |
ResetNextID - Resets taken entity IDs. Useful when a game has ended but entities were not destroyed, like ending play in editor or soft resetting a level.
nextId | - optional next available entity id |
void grail::AIEntity::SetReasoner | ( | std::unique_ptr< Reasoner > | newReasoner | ) |
SetReasoner.
reasoner |
void grail::AIEntity::StageBehavior | ( | std::unique_ptr< Behavior > | behavior | ) |
StageBehavior - Finishes the current behavior and starts a new one.
behavior |
std::unique_ptr< Reasoner > grail::AIEntity::TakeOwnershipOfReasoner | ( | ) |
GetCurrentReasoner.
|
protectedvirtual |
Update - User defined method. Should in some way update entity's state.
deltaTime |