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

A high-level abstraction of actions in the game. More...

#include <Behavior.hh>

Inheritance diagram for grail::Behavior:
Collaboration diagram for grail::Behavior:

Public Member Functions

 Behavior (std::unique_ptr< Behavior > recoveryBehavior=nullptr)
 
 Behavior (Behavior &&)=default
 
Behavioroperator= (const Behavior &)=delete
 
Behavioroperator= (Behavior &&)=delete
 
virtual void Start (AIEntity &owner)
 
virtual void Update (AIEntity &owner, float deltaTime)
 
virtual void Finish (AIEntity &owner, const BehaviorStatus status)
 
virtual bool IsFinished (const AIEntity &owner) const
 
virtual bool IsLegal (const AIEntity &owner) const
 
virtual bool IsInterruptible () const
 
BehaviorStatus GetStatus () const
 GetStatus. More...
 
virtual std::unique_ptr< BehaviorGetRecoveryBehavior ()
 
virtual std::string GetName () const
 

Protected Attributes

std::unique_ptr< BehaviorrecoveryBehavior {nullptr}
 

Friends

class AIEntity
 
class BehaviorSequence
 

Detailed Description

A high-level abstraction of actions in the game.

Member Function Documentation

◆ Finish()

void grail::Behavior::Finish ( AIEntity owner,
const BehaviorStatus  status 
)
virtual

Invoked after the behavior is finished or interrupted

Parameters
owner- the entity executing this behavior

Reimplemented in grail::BehaviorSequence, and grail::fsm::FSMBehavior.

◆ GetStatus()

BehaviorStatus grail::Behavior::GetStatus ( ) const

GetStatus.

Returns
behavior status (ACTIVE, SUSPENDED, FINISHED, DELEGALIZED)

◆ IsFinished()

bool grail::Behavior::IsFinished ( const AIEntity owner) const
virtual
Parameters
owner- the entity executing this behavior

Reimplemented in grail::BehaviorSequence, and grail::fsm::FSMBehavior.

◆ IsInterruptible()

bool grail::Behavior::IsInterruptible ( ) const
virtual
Returns
true if this behavior's execution can be interrupted by a Reasoner

Reimplemented in grail::BehaviorSequence.

◆ IsLegal()

bool grail::Behavior::IsLegal ( const AIEntity owner) const
virtual
Parameters
owner- the entity executing this behavior
Returns
true if this behavior instance should be considered by decision making algorithms, false otherwise

Reimplemented in grail::BehaviorSequence, and grail::fsm::FSMBehavior.

◆ Start()

void grail::Behavior::Start ( AIEntity owner)
virtual

Invoked after the behavior is assigned to AIEntity

Parameters
owner- the entity executing this behavior

Reimplemented in grail::BehaviorSequence, and grail::fsm::FSMBehavior.

◆ Update()

void grail::Behavior::Update ( AIEntity owner,
float  deltaTime 
)
virtual

Invoked on each AIManager update

Parameters
owner- the entity executing this behavior

Reimplemented in grail::BehaviorSequence, and grail::fsm::FSMBehavior.


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