Grail (C#)  1.3.0
A multi-platform, modular, universal engine for embedding advanced AI in games.
Grail.Core.AIEntity Class Reference

Defines a basic object which can execute behaviors. More...

Collaboration diagram for Grail.Core.AIEntity:

Public Member Functions

 AIEntity (string name="")
 Constructs an AIEntity with the given name. More...
 
void AddSharedBlackboard (string key, Blackboard blackboard)
 Inserts pair of key and blackboard into container of shared blackboards. More...
 
Blackboard GetSharedBlackboard (string key)
 Gets shared blackboard identified by given key. More...
 
Behavior MoveSuspendedBehavior ()
 Gets reference to a previously assigned behavior that has been suspended by a new one. More...
 
void StageBehavior (Behavior behavior)
 Finishes the current behavior and starts a new one. More...
 
void AddReasonerChangeObserver (IReasonerChangeObserver observer)
 Adds a reasoner change observer that will be notified via calling OnReasonerSet function when a new reasoner is be assigned to an entity. More...
 
void RemoveReasonerChangeObserver (IReasonerChangeObserver observer)
 Removes a reasoner change observer so it won't be notified of reasoner changes anymore. More...
 

Static Public Member Functions

static void ResetNextId (int nextId=0)
 Resets available entity IDs. Useful when the game should be restarted but entities were not destroyed, like ending Play in Editor or soft restarting level. More...
 

Public Attributes

Blackboard Blackboard => blackboard
 Blackboard owned by this entity. More...
 
bool HasActiveBehavior => currentBehavior != null
 Checks whether current behavior is not nullptr. More...
 
Dictionary< string, BlackboardSharedBlackboards => sharedBlackboards
 

Protected Attributes

readonly Dictionary< string, BlackboardsharedBlackboards
 
Reasoner reasoner
 

Properties

string Name [get]
 A name used for display and debug purposes. More...
 
Behavior CurrentBehavior [get]
 get - Behavior currently assigned to this entity. More...
 
bool HasStagedBehavior [get]
 Checks whether this entity has a behavior awaiting its execution. More...
 
int Id [get]
 A unique integer id assigned by AIManager during construction. More...
 
Reasoner Reasoner = nextEntityId++ [get, set]
 Reasoner assigned to this entity. More...
 

Detailed Description

Defines a basic object which can execute behaviors.

Constructor & Destructor Documentation

◆ AIEntity()

Grail.Core.AIEntity.AIEntity ( string  name = "")
inline

Constructs an AIEntity with the given name.

Parameters
name

Member Function Documentation

◆ AddReasonerChangeObserver()

void Grail.Core.AIEntity.AddReasonerChangeObserver ( IReasonerChangeObserver  observer)
inline

Adds a reasoner change observer that will be notified via calling OnReasonerSet function when a new reasoner is be assigned to an entity.

Parameters
observer

◆ AddSharedBlackboard()

void Grail.Core.AIEntity.AddSharedBlackboard ( string  key,
Blackboard  blackboard 
)
inline

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

Parameters
key
blackboard

◆ GetSharedBlackboard()

Blackboard Grail.Core.AIEntity.GetSharedBlackboard ( string  key)
inline

Gets shared blackboard identified by given key.

Parameters
key
Returns

◆ MoveSuspendedBehavior()

Behavior Grail.Core.AIEntity.MoveSuspendedBehavior ( )
inline

Gets reference to a previously assigned behavior that has been suspended by a new one.

Returns

◆ RemoveReasonerChangeObserver()

void Grail.Core.AIEntity.RemoveReasonerChangeObserver ( IReasonerChangeObserver  observer)
inline

Removes a reasoner change observer so it won't be notified of reasoner changes anymore.

Parameters
observer

◆ ResetNextId()

static void Grail.Core.AIEntity.ResetNextId ( int  nextId = 0)
inlinestatic

Resets available entity IDs. Useful when the game should be restarted but entities were not destroyed, like ending Play in Editor or soft restarting level.

Parameters
nextIdOptional next available entity id

◆ StageBehavior()

void Grail.Core.AIEntity.StageBehavior ( Behavior  behavior)
inline

Finishes the current behavior and starts a new one.

Parameters
behavior

Member Data Documentation

◆ Blackboard

Blackboard Grail.Core.AIEntity.Blackboard => blackboard

Blackboard owned by this entity.

◆ HasActiveBehavior

bool Grail.Core.AIEntity.HasActiveBehavior => currentBehavior != null

Checks whether current behavior is not nullptr.

Property Documentation

◆ CurrentBehavior

Behavior Grail.Core.AIEntity.CurrentBehavior
get

get - Behavior currently assigned to this entity.

◆ HasStagedBehavior

bool Grail.Core.AIEntity.HasStagedBehavior
get

Checks whether this entity has a behavior awaiting its execution.

◆ Id

int Grail.Core.AIEntity.Id
get

A unique integer id assigned by AIManager during construction.

◆ Name

string Grail.Core.AIEntity.Name
get

A name used for display and debug purposes.

◆ Reasoner

Reasoner Grail.Core.AIEntity.Reasoner = nextEntityId++
getset

Reasoner assigned to this entity.


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