Components

This page presents functionalities provided by Grail plugin’s components.

AI Manager Component

This component holds ownership of one instance of AIManager component. The user should make sure that at least one AIManagerComponent is present on each scene in which they desire to place Grail controlled agents.

The default implementation of AIManagerComponent updates registered entities and their reasoners every frame. If the user requirements are different, they should inherit from AIManagerComponent and provide a different logic.

AI Entity Component

This component holds ownership of one instance of AIEntity. Every object that should be able to make decisions requires this component.

The user can define which entity from a given GrailConfigurationLoader associated with a desired config file will be constructed in each instance of this component.

Additionally, it is possible for the created entity to be registered on scene startup.

Exemplar AIEntityComponent inspector

Important API

Entity

  • A readonly property returning currently owned AIEntity.

OnEntityCreated

  • An event which will be called once the owned AIEntity is ready to be used. Said AIEntity is passed as an argument of this call.

OnEntityDestroyed

  • Event which will be called right before object is destroyed. Owned AIEntity is passed as an argument of this call.

Entity Group Component

This component holds ownership of one instance of groups of AIEntities. User should use this whenever object they want to use should be controlled by more than one "mind".

A user can define which group from given GrailConfigurationLoader associated with desired config file will be constructed in each instance of this component.

Additionally, it is possible to order group to be registered on scene startup.

Exemplar EntityGroupComponent inspector

Important API

Entities

  • Readonly property returning list of currently owned AIEntities

OnGroupCreated

  • Event which will be called once owned AIEntities are ready to be used. Said entities are passed as an argument of this call along with mapping of local blackboards.

OnGroupsDestroyed

  • Event which will be called right before object is destroyed. Owned entities are passed as arguments of this call along with mapping of local blackboards.

Blackboard Data Provider

Component which allows user to provide entity’s internal blackboard with custom data right when it’s ready to be used. Should be attached to the object with AIEntityComponent or EntityGroupComponent.

Important API

Awake

  • This Unity method should be overriden and requires calling Awake from base class. It is neccessary so the object can subscribe to proper entity event.

ProvideBlackboardData

  • Virtual method which will be called as soon as entity is ready to be used. User should override this method and write desired data to entity’s blackboard given as an argument of the call.